On Sun, 18 May 2008, Ryan Hitchman wrote:
I'd like to propose an addition to the for statement's syntax:
for {variable} in {iterable} if {condition}:
{block}
which is equivalent to
for {variable} in {iterable}:
if not {condition}:
continue
{block}
and
for {variable} in filter(lambda: {condition}, iterable):
{block}
This would make the syntax closer to that of generators, which have
'for variable in iterable if condition', and would improve code
clarity by increased brevity and not negating boolean expressions.
http://mail.python.org/pipermail/python-dev/2006-May/065090.html
This was proposed and rejected before, after which it was again proposed
and rejected. I think it was also proposed and rejected sometime in 2007,
but I can't seem to find it in the archives so my memory may be faulty.
The idea is apparently not dead yet. Hang around a couple of minutes,
though. It won't be long.
Isaac Morland CSCF Web Guru
DC 2554C, x36650 WWW Software Specialist
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com