[New-bugs-announce] [issue5823] feature request: a conditional "for" statement
Michael Gilbert
report at bugs.python.org
Fri Apr 24 00:10:04 CEST 2009
New submission from Michael Gilbert <michael.s.gilbert at gmail.com>:
hello, i've recently been working on some code where i am processing a
list, but excluding certain items. the solution is to use a list
comprehension in the for statement, which for example looks like:
for m in [n for n in range( 0 , 5 ) if n != 2]
determining what's going on here isn't immediately obvious (i.e. what's
this new variable n doing?). it would be nice to have a more
streamlined syntax such as:
for m in range( 0 , 5 ) with m != 2
which is much cleaner and obvious. the statements following "with"
could be any conditional expression.
this is just a wishlist item, and i understand that it wouldn't have
much priority in the grand scheme of things. thank you for your
consideration.
----------
components: Interpreter Core
messages: 86377
nosy: zero79
severity: normal
status: open
title: feature request: a conditional "for" statement
type: feature request
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5823>
_______________________________________
More information about the New-bugs-announce
mailing list