At 10:56 AM 3/26/2009 +0000, Antoine Pitrou wrote:
Guido van Rossum <guido <at> python.org> writes:
>
> That's stating it a little too strongly. Phillip has shown how with
> judicious use of decorators and helper classes you can get a
> reasonable approximation, and I think Twisted uses something like
> this, so it's not just theory. I think the best you can do without new
> syntax though is still pretty cumbersome and brittle, which is why I
> have encouraged your PEP.
It remains to be seen whether Twisted and other libraries (Kamaelia?) can
benefit from this PEP.
They don't get any new features, and would require (possibly
significant) changes in order to be able to take advantage of the syntax.
And they *still* wouldn't be able to do away with their trampolines
-- the new trampolines would just be able to avoid the need for a
generator stack, if they previously had one to begin with. From your
description, it sounds like Twisted's version of this doesn't even use a stack.
(Note: by "trampoline" I mean, "thing that processes yielded values
and manages the resumption of the generator", which need not be
global. The example trampoline I posted earlier is also implemented
as a decorator, and could be trivially extended via a lookup table to
handle deferreds, delayed calls, or whatever else you wanted it to
support as yield targets.)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com