[Python-ideas] "While" suggestion
python at rcn.com
Thu Jul 3 18:16:05 CEST 2008
>> 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.
+1 from me also. This is a simple, clean proposal.
The syntax is self-explanatory and has a near zero
More information about the Python-ideas