Full Byte Developer.

Goroutines vs Python coroutines

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

Published here , updated · 4 sources

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)
Startgo f() [1]create a Task / asyncio.run [3]
Suspend syntaxnone (await is not a Go keyword)await on awaitables [3]
Default schedulerGo runtime across OS threads [1]one event loop in the process [3]
Preferred coordinationchannels [4]Tasks, Futures, asyncio sync primitives [3]

Related reading: Go without async await, Concurrency vs parallelism, and Python async def is lazy until you await. Browse the dev-explainers topic.

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].

Go: go f() many goroutines Go scheduler few OS threads Python: async def coroutine object event loop await resumes body Same word "concurrent"; different start, suspend, and wait rules.

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 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.

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. 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.

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

TemptationProblem
Rewrite every async def as go funcDifferent cancellation, error, and I/O models
Await a goroutineGo has no await; use channels, WaitGroup, or errgroup
go a CPU loop and ignore racesRuntime concurrency without memory rules
time.sleep inside a coroutineBlocks the whole loop; use asyncio.sleep [3]
Share a map across goroutines with no lockData 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 and Python GIL threads are not parallel.

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

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.
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.

Keep this guide

By Full Byte Developer

Filed under Dev explainers

Questions about this guide

Is a Python coroutine a thread?

No. The glossary defines coroutines as a more generalized form of subroutines that can be entered, exited, and resumed at many different points, and that can be implemented with async def. asyncio runs many of them on an event loop.

Is a goroutine a coroutine?

Related idea, different runtime. Effective Go defines a goroutine as a function executing concurrently with other goroutines in the same address space. Go schedules it; you do not await it with language keywords.

Which one is better for CPU work?

Neither keyword alone gives you free CPU parallelism. In Python, CPU-bound pure Python usually wants processes. In Go, the runtime can run goroutines on multiple OS threads, but your code still must avoid accidental sharing bugs.

Can I translate async def to go func one-for-one?

Not safely. asyncio expects awaitable I/O and a running loop. Go expects you to start goroutines and synchronize with channels or sync primitives.

Sources

Next in this stack