On Mon, May 19, 2008 at 5:55 AM, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> "Ryan Hitchman" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> | 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}
>
> Is this different from
> for var in filter(lambda x: condition(x), iterable)):
> ?
>
> | and
> |
> | for {variable} in filter(lambda: {condition}, iterable):
> |    {block}
>
> IDLE 3.0a5
>>>> for i in filter(lambda i: i%2, range(10)):
>  print(i)
>
>
> 1
> 3
> 5
> 7
> 9

How was it again? "One and only one way"? :-)

-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64
_______________________________________________
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

Reply via email to