while expression feature proposal
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Thu Oct 25 05:52:31 EDT 2012
Am 25.10.2012 06:50 schrieb Terry Reedy:
> Keep in mind that any new syntax has to be a substantial improvement in
> some sense or make something new possible. There was no new syntax in
> 3.2 and very little in 3.3.
I would consinder this at least as new substantial than
yield_from it
as opposed to
for i in it: yield i
- although I think that was a good idea as well.
Although there are quite easy ways to do so, I would appreciate
something like the proposed
while EXPR as VAR: use VAR
if EXPR as VAR: use VAR
Of course it is possible to construct a respective workaround such as
def maybe_do_that():
if moon == full:
with something as val:
yield val
for val in maybe_do_that():
bla
but I would consider this as an abuse of the generator concept.
Thomas
More information about the Python-list
mailing list