Re: [Python-Dev] Coroutines and PEP 380

2012-01-24 Thread Matt Joiner
After much consideration, and playing with PEP380, I've changed my stance on this. Full blown coroutines are the proper way forward. greenlet doesn't cut it because the Python interpreter isn't aware of the context switches. Profiling, debugging and tracebacks are completely broken by this.

Re: [Python-Dev] Coroutines and PEP 380

2012-01-21 Thread Greg Ewing
Glyph wrote: Yes, but you /can/ look at a 'yield' and conclude that you /might/ need a lock, and that you have to think about it. My concern is that you will end up with vastly more 'yield from's than places that require locks, so most of them are just noise. If you bite your nails over

Re: [Python-Dev] Coroutines and PEP 380

2012-01-21 Thread Matt Joiner
My concern is that you will end up with vastly more 'yield from's than places that require locks, so most of them are just noise. If you bite your nails over whether a lock is needed every time you see one, they will cause you a lot more anxiety than they alleviate. Not necessarily. The

Re: [Python-Dev] Coroutines and PEP 380

2012-01-19 Thread Greg
Glyph wrote: [Guido] mentions the point that coroutines that can implicitly switch out from under you have the same non-deterministic property as threads: you don't know where you're going to need a lock or lock-like construct to update any variables, so you need to think about concurrency

Re: [Python-Dev] Coroutines and PEP 380

2012-01-19 Thread Matt Joiner
On Fri, Jan 20, 2012 at 8:41 AM, Greg greg.ew...@canterbury.ac.nz wrote: Glyph wrote: [Guido] mentions the point that coroutines that can implicitly switch out from under you have the same non-deterministic property as threads: you don't know where you're going to need a lock or lock-like

Re: [Python-Dev] Coroutines and PEP 380

2012-01-19 Thread Glyph
On Jan 19, 2012, at 4:41 PM, Greg wrote: Glyph wrote: [Guido] mentions the point that coroutines that can implicitly switch out from under you have the same non-deterministic property as threads: you don't know where you're going to need a lock or lock-like construct to update any

Re: [Python-Dev] Coroutines and PEP 380

2012-01-18 Thread Mark Shannon
Matt Joiner wrote: Just to clarify, this differs in functionality from enhanced generators by allowing you to yield from an arbitrary call depth rather than having to yield from through a chain of calling generators? Furthermore there's no syntactical change except to the bottommost frame

Re: [Python-Dev] Coroutines and PEP 380

2012-01-18 Thread Mark Shannon
Glyph wrote: On Jan 17, 2012, at 5:03 PM, Mark Shannon wrote: Lets start controversially: I don't like PEP 380, I think it's a kludge. Too late; it's already accepted. There's not much point in making controversial statements about it now. Why is it too late? Presenting this as a fait

Re: [Python-Dev] Coroutines and PEP 380

2012-01-18 Thread Glyph
On Jan 18, 2012, at 4:23 AM, Mark Shannon wrote: Glyph wrote: On Jan 17, 2012, at 5:03 PM, Mark Shannon wrote: Lets start controversially: I don't like PEP 380, I think it's a kludge. Too late; it's already accepted. There's not much point in making controversial statements about it now.

Re: [Python-Dev] Coroutines and PEP 380

2012-01-18 Thread Matt Joiner
PEP380 and Mark's coroutines could coexist, so I really don't it's too late matters. Furthermore, PEP380 has utility in its own right without considering its use for explicit coroutines. I would like to see these coroutines considered, but as someone else mentioned, coroutines via PEP380 enhanced

[Python-Dev] Coroutines and PEP 380

2012-01-17 Thread Mark Shannon
Hi all. Lets start controversially: I don't like PEP 380, I think it's a kludge. I think that CPython should have proper coroutines, rather than add more bits and pieces to generators in an attempt to make them more like coroutines. I have mentioned this before, but this time I have done

Re: [Python-Dev] Coroutines and PEP 380

2012-01-17 Thread Matt Joiner
Just to clarify, this differs in functionality from enhanced generators by allowing you to yield from an arbitrary call depth rather than having to yield from through a chain of calling generators? Furthermore there's no syntactical change except to the bottommost frame doing a co_yield? Does this

Re: [Python-Dev] Coroutines and PEP 380

2012-01-17 Thread Ethan Furman
Mark Shannon wrote: I think that CPython should have proper coroutines, rather than add more bits and pieces to generators in an attempt to make them more like coroutines. I have mentioned this before, but this time I have done something about it :) I have a working, portable, (asymmetric)

Re: [Python-Dev] Coroutines and PEP 380

2012-01-17 Thread Glyph
On Jan 17, 2012, at 5:03 PM, Mark Shannon wrote: Lets start controversially: I don't like PEP 380, I think it's a kludge. Too late; it's already accepted. There's not much point in making controversial statements about it now. I think that CPython should have proper coroutines, rather than