[Python-Dev] PEP 340 -- concept clarification
Phillip J. Eby
pje at telecommunity.com
Wed May 4 01:27:42 CEST 2005
At 03:33 PM 5/3/05 -0700, Guido van Rossum wrote:
>[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 don't understand you. Are you suggesting a horse trade, or...?
>I had never heard of that PEP. How much code is there in the field?
Maybe a dozen or so web applications and frameworks (including Zope,
Quixote, PyBlosxom) and maybe a half dozen servers (incl. Twisted and
mod_python). A lot of the servers are based on my wsgiref library, though,
so it probably wouldn't be too horrible a job to make everybody add
support; I might even be able to fudge wsgiref so that wsgiref-based
servers don't even see an issue.
Modifying the spec is potentially more controversial, however; it'll have
to go past the Web-SIG, and I assume the first thing that'll be asked is,
"Why aren't generators getting a close() method then?", so I figured I
should ask that question first.
I'd completely forgotten about this being an issue until Raymond mentioned
g.close(); I'd previously gotten the impression that PEP 325 was expected
to be approved, otherwise I wouldn't have written support for it into PEP 333.
>Written by whom?
I used to know who all had written implementations, but there are now too
many to keep track of.
More information about the Python-Dev
mailing list