[Python-ideas] "While" suggestion
facundobatista at gmail.com
Thu Jul 3 17:22:16 CEST 2008
2008/7/3 George Sakkis <george.sakkis at gmail.com>:
> There is already an idiom for this, although admittedly not obvious or
> for data in iter(lambda: my_file.read(1024), ''):
> or in 2.5+:
> from functools import partial
> for data in iter(partial(my_file.read,1024), ''):
Yes, but note that these feels like workarounds.
One thing that I love in Python is that you can learn a concept, and
apply it a lot of times.
So, suppose I'm learning Python and find that I can do this...
with_stmt ::= "with" expression ["as" target] ":" suite
...why can't I do this?:
while_stmt ::= "while" expression ["as" target] ":" suite
I mean, I don't care if this solves a lot of issues, or just a few
... this just make the whole syntax more coherent.
 Note, however, that one of the issues that it solves is one that
raises always a lot of questions for newbies... how to make a
More information about the Python-ideas