Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Lennart Regebro
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

Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Steven D'Aprano
On Mon, 19 May 2008 08:42:29 pm Lennart Regebro wrote: How was it again? One and only one way? :-) Certainly not. What on earth gave you the idea that that ridiculous statement is a Python philosophy? I know some Perl developers like to contrast the supposed flexibility of Perl (more than one

Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Nick Coghlan
Ryan Hitchman wrote: This would make the syntax closer to that of generators, which have 'for variable in iterable if condition', Incorporating the filter condition into the list comprehension syntax (and later into generator expressions) is necessary because they need to be written as a

Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Alex Martelli
On Mon, May 19, 2008 at 5:33 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: ... import this The Zen of Python, by Tim Peters ... There should be one-- and preferably only one --obvious way to do it. There should be ONE OBVIOUS way to do it, not only one way. The only one way phrasing is in

Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Ryan Hitchman
On Sun, May 21, 2006 at 17:38:49 CEST, Guido van Rossum guido at python.org wrote ... Also, it would be a parsing conflict for the new conditional expressions (x if T else y). ... That's all I needed to know. Sorry, everyone, I'll try not to waste your time in the future.

[Python-Dev] Conditional For Statements

2008-05-18 Thread Ryan Hitchman
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):

Re: [Python-Dev] Conditional For Statements

2008-05-18 Thread Eli Courtwright
First, the best list on which to discuss this would be Python-Ideas not Python-Dev. Second, this was brought up there a few months ago, although not much discussion ensued: http://mail.python.org/pipermail/python-ideas/2008-March/001407.html - Eli On Sun, May 18, 2008 at 9:45 PM, Ryan Hitchman

Re: [Python-Dev] Conditional For Statements

2008-05-18 Thread Isaac Morland
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

Re: [Python-Dev] Conditional For Statements

2008-05-18 Thread Terry Reedy
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}: |