[Python-Dev] Extended Function syntax

Samuele Pedroni pedronis@bluewin.ch
Mon, 3 Feb 2003 00:29:20 +0100


[me]
> 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:
>     ...
>

I think that the fact that the above is wrong and the latter is right, is very
symptomatic of the fact that the '=' in

do lval = expr:
  suite

is rather ambiguous.