[Python-Dev] PEP 340 -- concept clarification

Guido van Rossum gvanrossum at gmail.com
Wed May 4 00:33:37 CEST 2005


[Phillip]
> That reminds me of something; in PEP 333 I proposed use of a 'close()'
> attribute in anticipation of PEP 325, so that web applications implemented
> as generators could take advantage of resource cleanup.  Is there any
> chance that as part of PEP 340, 'close()' could translate to the same as
> '__exit__(StopIteration)'?  If not, modifying PEP 333 to support '__exit__'
> is going to be a bit of a pain, especially since there's code in the field
> now with that assumption.

Maybe if you drop support for the "separate protocol" alternative... :-)

I had never heard of that PEP. How much code is there in the field?
Written by whom?

I suppose you can always write a decorator that takes care of the
mapping. I suppose it should catch and ignore the StopIteration that
__exit__(StopIteration) is likely to throw.

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


More information about the Python-Dev mailing list