[Python-Dev] PEP 340 -- loose ends
Rodrigo Dias Arruda Senra
rodsenra at gpr.com.br
Wed May 4 21:12:33 CEST 2005
[ Senra ]:
> > [ Guido ]:
> > > 1. Decide on a keyword to use, if any.
> >
> > Shouldn't be the other way around ?
> > Decide to use *no* keyword, if that could be avoided.
[ Reinhold ]:
> There is one problem with using no keyword: You cannot use arbitrary expressions
> in the new statement. Consider:
>
> resource = opening("file.txt")
> block resource:
> (...)
>
> resource = opening("file.txt")
> resource:
> (...)
>
> The latter would have to be forbidden.
I'm not quite sure why, but there seem to be a
workaround (forseen in PEP 340). And people seem
to be "using" this already <0.5 wink>:
[Alex Martelli]:
> for name in filenames:
> opening(name) as f:
> if f.read(2) == 0xFEB0: break
Moreover, an anonymous block should have
no <<name>> (neither 'block', 'with', 'using')
to be true anonymous <1.0-Tim-Peter'ly wink>
cheers,
Senra
--
Rodrigo Senra
--
MSc Computer Engineer rodsenra(at)gpr.com.br
GPr Sistemas Ltda http://www.gpr.com.br/
Personal Blog http://rodsenra.blogspot.com/
More information about the Python-Dev
mailing list