Ask HN: Coroutines in Python. Good? Bad? Ugly?
I've been tempted to start using coroutines in my Python code, but I'm concerned I might be shooting myself in the foot by using them.
What's your experience using coroutines? Good? Bad? Ugly?
What's your experience using coroutines? Good? Bad? Ugly?
Co-routines are a tool, and like any other, using in the wrong way, for the wrong thing, or badly, makes more problems than it solves. When used carefully and appropriately, the code is cleaner, clearer, and simply better.
I've used co-routines many times in the past 30 years, and they have been utterly indispensible.
Often instead of co-routines you can use generators in the same context. Worth considering. See here: