# Goroutines vs Python coroutines

> Go goroutines are scheduled functions. Python coroutines need an event loop. Different rules.

Source: https://fullbytedeveloper.com/blog/goroutines-vs-coroutines
Published here: 2026-11-26, updated 2026-12-03

People mash "lightweight concurrent function" into one idea and treat Go goroutines and Python coroutines as twins. Effective Go defines a goroutine as a function executing concurrently with other goroutines in the same address space. Python's glossary says a coroutine can suspend and resume at many points. The runtimes are not interchangeable [1][2].

## One minute: start both on this machine

Python builds a coroutine object when you call `async def`. The body stays idle until an event loop schedules it [2][3].

```bash
python3 - <<'PY'
import asyncio

async def work():
    print("python body")

coro = work()
print(type(coro))
asyncio.run(coro)
PY
```

Captured output on this host (Python 3, 2026-12-03):

```text
<class 'coroutine'>
python body
```

Go starts a goroutine with `go`. The runtime schedules it; the parent must wait or the process can exit first [1].

```bash
cat > /tmp/goro.go <<'EOF'
package main
import ("fmt"; "sync")
func main() {
    var wg sync.WaitGroup
    wg.Add(1)
    go func() { defer wg.Done(); fmt.Println("go body") }()
    wg.Wait()
}
EOF
go run /tmp/goro.go
```

Captured output (Go 1.22.2 on this host):

```text
go body
```

That pair is the whole beginner contrast: Python needs a loop (or `asyncio.run`) before the body runs; Go needs an explicit wait so the process outlives the child.

## Put the definitions side by side

Effective Go: a goroutine is a function executing concurrently with other goroutines in the same address space. You launch it with `go` and the runtime schedules it across OS threads as it sees fit [1].

Python glossary: a coroutine is a more generalized form of subroutine that can be entered, exited, and resumed at many different points, and can be implemented with `async def` [2]. In modern Python you write `async def` and drive the work with asyncio tasks on an event loop [3].

| | Goroutine (Go) | Coroutine (Python asyncio) |
| --- | --- | --- |
| Start | `go f()` [1] | create a Task / `asyncio.run` [3] |
| Suspend syntax | none (`await` is not a Go keyword) | `await` on awaitables [3] |
| Default scheduler | Go runtime across OS threads [1] | one event loop in the process [3] |
| Preferred coordination | channels [4] | Tasks, Futures, asyncio sync primitives [3] |

Related reading: [Go without async await](/blog/go-without-async-await), [Concurrency vs parallelism](/blog/concurrency-vs-parallelism-plain), and [Python async def is lazy until you await](/blog/python-async-def-is-lazy). Browse the [dev-explainers topic](https://fullbytedeveloper.com/blog/topic/dev-explainers).

## Watch the two shapes as a diagram

The Venice hero on this page is the same split: many teal lines onto a few amber tracks versus one cooperative ring. In prose form, Go multiplexes many goroutines onto fewer OS threads (M:N). asyncio keeps many coroutines logically in flight on one loop thread unless you deliberately offload work [1][3].

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 280" role="img" aria-label="Go multiplexes goroutines onto OS threads; Python awaits on one event loop">
  <defs>
    <marker id="goroArrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="280" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">Go: go f()</text>
  <rect x="24" y="52" width="120" height="44" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="36" y="80" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">many goroutines</text>
  <path d="M144 74 H188" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#goroArrow)"/>
  <rect x="196" y="52" width="130" height="44" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="208" y="80" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Go scheduler</text>
  <path d="M326 74 H370" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#goroArrow)"/>
  <rect x="378" y="52" width="140" height="44" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="390" y="80" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">few OS threads</text>
  <text x="24" y="150" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">Python: async def</text>
  <rect x="24" y="166" width="150" height="44" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="36" y="194" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">coroutine object</text>
  <path d="M174 188 H218" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#goroArrow)"/>
  <rect x="226" y="166" width="150" height="44" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="238" y="194" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">event loop</text>
  <path d="M376 188 H420" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#goroArrow)"/>
  <rect x="428" y="166" width="170" height="44" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="440" y="194" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">await resumes body</text>
  <text x="24" y="250" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Same word "concurrent"; different start, suspend, and wait rules.</text>
</svg>
</figure>

*Go multiplexes onto OS threads; Python schedules coroutine bodies on an event loop after await points.*

## Prove the lazy Python call

Calling `async def` without awaiting only builds the object. The task docs assume you schedule work on a running loop [3].

```bash
python3 - <<'PY'
import asyncio

async def sleepy():
    await asyncio.sleep(0.01)
    print("awaited")

c = sleepy()
print("calling", type(c))
asyncio.run(c)
PY
```

Captured output:

```text
calling <class 'coroutine'>
awaited
```

A RuntimeWarning about "never awaited" appears when you discard the object without scheduling it. That warning is the language telling you the body never ran. See [Python async def is lazy](/blog/python-async-def-is-lazy) for the longer version of this trap [3].

## Watch the footguns that do not translate

In Python, calling a blocking `time.sleep` or a blocking database driver on the loop stalls every other coroutine. The task docs assume awaitable I/O. Offload blocking work to a thread or process pool when you must keep the loop responsive [3].

In Go, forgetting to synchronize shared maps is a data race. The Share Memory By Communicating codelab exists because shared mutable state without rules fails quietly until it fails loudly. Prefer channels or `sync` primitives [4]. See [Go without async await](/blog/go-without-async-await).

Classic CPython still has the GIL story for threads. Coroutines do not remove that constraint for pure-Python CPU work; see [Python GIL threads are not parallel](/blog/python-gil-threads-not-parallel). Go's runtime can place goroutines on multiple OS threads, which is why people casually say "goroutines are parallel" when they mean "the scheduler may use multiple threads." Structure of work and number of cores are separate questions; that split is the whole point of [concurrency vs parallelism](/blog/concurrency-vs-parallelism-plain).

## Cancellation and errors are not the same shape

asyncio cancellation is cooperative through `await` points. A task cancelled while stuck in blocking C code may not notice until it returns to the loop [3]. Go cancellation is usually a context you pass down, or closing a channel the workers select on [1][4]. Porting a Python `try`/`except` around `await gather` into a pile of bare `go` statements drops both cancellation and error aggregation unless you rebuild them with `errgroup` or explicit result channels.

Error surfaces differ too. An unhandled exception inside an asyncio Task is reported through the task; forgetting to retrieve it can leave a noisy "Task exception was never retrieved" warning [3]. An unrecovered panic in a goroutine crashes the process. Those are different failure modes with different ops playbooks.

## When not to translate one for one

| Temptation | Problem |
| --- | --- |
| Rewrite every `async def` as `go func` | Different cancellation, error, and I/O models |
| Await a goroutine | Go has no await; use channels, WaitGroup, or errgroup |
| `go` a CPU loop and ignore races | Runtime concurrency without memory rules |
| `time.sleep` inside a coroutine | Blocks the whole loop; use `asyncio.sleep` [3] |
| Share a map across goroutines with no lock | Data race; prefer channels or `sync` [4] |

Your next cross-language design note should name which table row you are on before anyone ports the syntax. The keyword that starts concurrent work is the easy part. The hard part is how that runtime resumes, cancels, and shares memory.

## Pick the mental model before the syntax

If the work is mostly waiting on sockets and you already live in Python, asyncio tasks match the glossary definition of coroutines and keep one loop honest about blocking calls [2][3]. If you need many concurrent functions in one address space with a runtime scheduler and channels, goroutines are the Effective Go tool [1][4]. Mixing the vocabularies in a review ("just await the goroutine") is how teams ship half-ported designs.

## Channels versus Futures in practice

Go's preferred coordination story is "do not communicate by sharing memory; share memory by communicating" [4]. That usually means a channel of results or a small struct of events. Python asyncio gives you Futures and Tasks that resolve to values, plus locks and queues in `asyncio` for shared state [3]. Both can express a worker pool. The Go version tends to push you toward ownership of messages on the channel. The Python version tends to push you toward awaiting a Task handle you already hold. Neither is "higher level"; they encode different default instincts about who owns the in-flight work.

A practical review question: when this work fails, who notices? In Go, a forgotten receive leaves a goroutine blocked and a sender stuck, or a panic takes down the process. In asyncio, an unretrieved Task exception becomes a warning, and a never-awaited coroutine never ran [3]. Write the failure path in the design note before you praise either syntax for being lightweight.

## Structured concurrency habits

Name the parent that owns the set of children. In Go that is often an `errgroup` or a WaitGroup tied to a request context. In asyncio that is often `asyncio.TaskGroup` (newer Pythons) or an explicit gather with error policy [3]. Orphan work is how both ecosystems grow leaks: Go goroutines that block forever on a channel nobody reads, Python tasks that outlive the request that created them. The Venice hero's left panel (many lines into few tracks) only stays healthy when something joins those lines back.

## CPU work and the wrong tool

People reach for goroutines or coroutines when the real need is parallel CPU. In CPython, pure-Python CPU loops want processes (or a native extension), not more coroutines on one loop [2][3]. In Go, CPU-heavy goroutines can use multiple threads, but you still pay for sharing: false sharing, lock contention, and accidental map races [1][4]. Measure with a profiler before you multiply workers by ten. Related: [concurrency vs parallelism](/blog/concurrency-vs-parallelism-plain) and [Python GIL threads are not parallel](/blog/python-gil-threads-not-parallel).

Send this to the friend who says goroutines are just async await with a Go accent.

Image: Two dark panels on a grid: left, many teal streams feed three amber tracks with right pointing arrows; right, a teal and amber ring links geometric shapes in a clockwise cooperative loop.
https://fullbytedeveloper.com/media/goroutines-vs-coroutines/goroutines-vs-coroutines-venice.webp
Left is M:N scheduling (many green tasks on a few amber runners). Right is a cooperative loop where work yields and resumes around one ring.

## Sources

1. [Effective Go: Goroutines, accessed 2026-11-26](https://go.dev/doc/effective_go#goroutines)
2. [Python glossary: coroutine, accessed 2026-11-26](https://docs.python.org/3/glossary.html#term-coroutine)
3. [Python docs: asyncio Task, accessed 2026-11-26](https://docs.python.org/3/library/asyncio-task.html)
4. [Go blog: Share Memory By Communicating, accessed 2026-11-26](https://go.dev/blog/codelab-share)
