[Python-Dev] PEP 340: Deterministic Finalisation (new PEP draft, either a competitor or update to PEP 340)
Josiah Carlson
jcarlson at uci.edu
Sat May 7 23:08:22 CEST 2005
Eric Nieuwland <eric.nieuwland at xs4all.nl> wrote:
>
> Nick Coghlan wrote:
>
> > [...]
> > The whole PEP draft can be found here:
> > http://members.iinet.net.au/~ncoghlan/public/pep-3XX.html
> > [...]
> > Used as follows::
> >
> > for del auto_retry(3, IOError):
> > f = urllib.urlopen("http://python.org/")
> > print f.read()
>
> I don't know. Using 'del' in that place seems ackward to me.
> Why not use the following rule:
> for [VAR in] EXPR:
> SUITE
> If EXPR is an iterator, no finalisation is done.
> If EXPR is not an iterator, it is created at the start and destroyed at
> the end of the loop.
You should know why that can't work. If I pass a list, is a list an
iterator? No, but it should neither be created nor destroyed before or
after.
The discussion has been had in regards to why re-using 'for' is a
non-starter; re-read the 200+ messages in the thread.
- Josiah
More information about the Python-Dev
mailing list