Coroutines

Learn about the close, throw, and send methods to support coroutines in Python.

The idea of a coroutine is to have a function, whose execution can be suspended at a given point in time, to be later resumed. By having this kind of functionality, a program might be able to suspend a part of the code, in order to dispatch something else for processing, and then come back to this original point to resume.

Get hands-on with 1200+ tech skills courses.