while expression feature proposal
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Thu Oct 25 12:15:36 EDT 2012
Am 25.10.2012 16:15 schrieb Grant Edwards:
> I guess that depends on what sort of programs you write. In my
> experience, EXPR is usually a read from a file/socket/pipe that
> returns '' on EOF. If VAR is not '', then you process, then you
> process it inside the loop.
Right. The same as in
if regex.search(string) as match:
process it
But with
def if_true(expr):
if expr: yield expr
you can do
for match in if_true(regex.search(string)):
process it
But the proposed if ... as ...: statment woulkd be more beautiful by far.
Thomas
More information about the Python-list
mailing list