

Ask HN:  Coroutines in Python.  Good?  Bad?  Ugly? - iamelgringo

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.<p>What's your experience using coroutines?  Good? Bad? Ugly?
======
jnoller
There's nothing magic - but there are a ton of libraries which make it better
than what's in core. I'd recommend taking a look at monocle,
eventlet/greenlet, and the other libs out there rather than trying to go it
alone.

------
RiderOfGiraffes
I've not used co-routines in Python, but on those occasions when I have used
them they have been ideal.

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:

<http://news.ycombinator.com/item?id=1742593>

