[Python-Dev] pre-PEP: Resource-Release Support for Generators

Armin Rigo arigo at tunes.org
Tue Sep 16 06:50:04 EDT 2003

Hello Phillip,

On Mon, Sep 15, 2003 at 11:26:27AM -0400, Phillip J. Eby wrote:
> i = iter(something)
> while 1:
>     try:
>         j=i.next()
>     except StopIteration:
>         break
> (...) is already complex enough as a mental model.

Makes sense. Then let's make sure, if both 'with' and 'yield within
try:finally' are accepted, that they are compatible, e.g. by having and
__exit__() method on generators (and not just a close()).


More information about the Python-Dev mailing list