[Python-Dev] Extended Function syntax

Samuele Pedroni pedronis@bluewin.ch
Sun, 2 Feb 2003 22:35:38 +0100


From: "Samuele Pedroni" <pedronis@bluewin.ch>
> > but it seems it would be harder for newbies to learn and use).
>
> to be fair I don't think that Guido suggested to add a iterclose builtin to
the
> language, OTOH nobody would be stopped to write and use it in its code,
> basically short of community style guides and pressure both:
>
> do iterclose(open('blah.txt','rb')): (line):
>     ...
>
> do myfile = autoclose(open('blah.txt','rb')):
>    for line in myfile:
>     ...

this one is wrong, it would have to be (assumed the current proposals):

do autoclose(open('blah.txt','rb')): (myfile):
   for line in myfile:
    ...

or

myfile = open('blah.txt','rb')
do autoclose(myfile):
   for line in myfile:
    ...

> would be potential idioms.
>
>