[Python-ideas] "While" suggestion
stavros at korokithakis.net
Thu Jul 3 16:51:42 CEST 2008
Hmm, I have no idea how to write a PEP, but if more people are amenable
to this, I will endeavour to!
Thanks for your feedback,
Facundo Batista wrote:
> 2008/7/3 Stavros Korokithakis <stavros at korokithakis.net>:
>> while my_file.read(1024) as data:
> Python explicitly disallows inline assignment ("while
> a=myfile.read():") because of the error propensity when confusing it
> with the comparation ("=="). But here we're gaining the same
> advantage, without that risk.
> So, taking into account that...
> a) We already have "as" as an statement.
> b) We already use "as" as an assignment 
> c) This will allow more concise and intuitive code
> ... I'm definitely +1 to this proposition.
> In any case, Stavros, this would need a PEP...
> Thank you!
>  http://docs.python.org/dev/reference/compound_stmts.html#the-with-statement
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 143 bytes
Desc: not available
More information about the Python-ideas