GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • [Python-Dev] Conditional For Statements
  • [Python-Dev] Conditional For Statements
  • [ date ]
  • [ thread ]
  • [ subject ]
  • [ author ]

This view

  • Original page
  • New address

GeezerVison is showing mail.python.org — [Python-Dev] Conditional For Statements

[Python-Dev] Conditional For Statements

Terry Reedy tjreedy at udel.edu
Mon May 19 05:55:28 CEST 2008

  • Previous message: [Python-Dev] Conditional For Statements
  • Next message: [Python-Dev] Conditional For Statements
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

"Ryan Hitchman" <hitchmanr at gmail.com> wrote in message 
news:e60c31470805181845u7fb0cafdsb0878db491eb7a3c at mail.gmail.com...
| 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




  • Previous message: [Python-Dev] Conditional For Statements
  • Next message: [Python-Dev] Conditional For Statements
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the Python-Dev mailing list
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.