[Python-Dev] Merging PEP 310 and PEP 340-redux?

Guido van Rossum gvanrossum at gmail.com
Thu May 12 18:21:04 CEST 2005


[Guido van Rossum]
> >- Paul Moore wants the generator templates to explicitly contain
> >   try/finally (or try/except, depending on the use case).  That's much
> >   more work though (passing exceptions into a generator is a new
> >   feature) and is not necessary to get the "redux" version.

[Phillip J. Eby]
> Uh oh.  Speaking on behalf of the "coroutine-y people" :), does this mean
> that we're not going to get the ability to pass exceptions into generators?

That would be a separate proposal (PEP 288 or PEP 325).

The do/with statement with its __enter__ and __exit__ APIs is entirely
independent from generators. Having shown a few non-generator do/with
wrappers I'm not so sure there's a lot of need for generators here;
especially since generators will always have that
round-peg-square-hole feeling when they're used in a non-looping
context. But I still want to leave the door open for using generators
as do/with-templates, hence my modification of PEP 310 (otherwise we
could just accept PEP 310 as is and be done with it).

For coroutines, see PEP 342.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list