Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-16 Thread Andrew Koenig
Peter Hansen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dave Hansen wrote: So lose the if. R = C then A else B I think that part of the argument for the A if C else B syntax is that then is not currently a reserved word. --

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-14 Thread Bengt Richter
On Wed, 12 Oct 2005 02:15:40 -0400, Chris Smith [EMAIL PROTECTED] wrote: Sebastian == Sebastian Bassi [EMAIL PROTECTED] writes: Sebastian On 9/30/05, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-13 Thread Piet van Oostrum
[EMAIL PROTECTED] (Dave Hansen) (DH) wrote: DH So lose the if. DHR = C then A else B DH I don't think python uses the question mark for anything. Throw that DH in, if it makes parsing easier: DHR = C ? then A else B We have already had this discussion several times. I don't think it

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-13 Thread Dave Hansen
On Thu, 13 Oct 2005 21:49:15 +0200, Piet van Oostrum [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Dave Hansen) (DH) wrote: DH So lose the if. DHR = C then A else B DH I don't think python uses the question mark for anything. Throw that DH in, if it makes parsing easier: DHR = C ?

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-13 Thread Chris Smith
Duncan == Duncan Booth [EMAIL PROTECTED] writes: Duncan Chris Smith wrote: What I really want to do is take four lines of conditional, and put them into one, as well as blow off dealing with a 'filler' variable: return the answer is + yes if X==0 else no

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Chris Smith
Sebastian == Sebastian Bassi [EMAIL PROTECTED] writes: Sebastian On 9/30/05, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Dave Hansen
On Tue, 11 Oct 2005 01:06:30 -0400, George Sakkis [EMAIL PROTECTED] wrote: Dave Hansen [EMAIL PROTECTED] wrote: On Mon, 10 Oct 2005 16:42:34 -0500, Terry Hancock [EMAIL PROTECTED] wrote: On Sunday 09 October 2005 07:50 am, phil hunt wrote: On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Dave Hansen
On Wed, 12 Oct 2005 13:02:20 +0200, Piet van Oostrum [EMAIL PROTECTED] wrote: Paul Rubin http://[EMAIL PROTECTED] (PR) wrote: [...] PR Yeah, if C then A else B is a ancient tradition stretching from PR Algol-60 to OCAML, and who knows what all else in between. I'm not PR sure what Guido saw

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Roy Smith
Chris Smith [EMAIL PROTECTED] wrote: What I really want to do is take four lines of conditional, and put them into one, as well as blow off dealing with a 'filler' variable: return the answer is + yes if X==0 else no I would write this as: return the answer is + (yes if X==0 else no) Adding

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Peter Hansen
Dave Hansen wrote: So lose the if. R = C then A else B It would be nice (in my opinion) if this were the way it was going to be. Having one of the two results come first makes that result seem somehow of primary importance, while the conditional (which in my mind is far more important

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-11 Thread Eric Nieuwland
Dave Hansen wrote: And Basic, and Fortran, and Lisp, and just about any programming language you care to name, including python (if Condition: Affirmative else: Negative). Not to mention that the sequence is identical to execution order. It's just plain goofy to have to scan to the middle of

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-11 Thread Antoon Pardon
Op 2005-10-10, Terry Hancock schreef [EMAIL PROTECTED]: On Sunday 09 October 2005 07:50 am, phil hunt wrote: On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock [EMAIL PROTECTED] wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as written pretty much

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-11 Thread William Park
Paul Rubin http://[EMAIL PROTECTED] wrote: Reinhold Birkenfeld [EMAIL PROTECTED] writes: For a conditional, syntax must be found, and the tradition of Python design is not to use punctuation for something that can be solved with keywords. Yeah, if C then A else B is a ancient tradition

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-10 Thread Terry Hancock
On Sunday 09 October 2005 07:50 am, phil hunt wrote: On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock [EMAIL PROTECTED] wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as written pretty much makes sense). I know, let's re-write Python to make it

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-10 Thread Dave Hansen
On Mon, 10 Oct 2005 16:42:34 -0500, Terry Hancock [EMAIL PROTECTED] wrote: On Sunday 09 October 2005 07:50 am, phil hunt wrote: On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock [EMAIL PROTECTED] wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-10 Thread Sebastian Bassi
On 9/30/05, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y I don't understand why there is a new expression, if this could be accomplished

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-10 Thread Peter Hansen
Sebastian Bassi wrote: I don't understand why there is a new expression, if this could be accomplished with: if C: X else: Y What is the advantage with the new expression? It actually is an expression, whereas your example shows a statement (so this could _not_ be accomplished with

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-10 Thread George Sakkis
Dave Hansen [EMAIL PROTECTED] wrote: On Mon, 10 Oct 2005 16:42:34 -0500, Terry Hancock [EMAIL PROTECTED] wrote: On Sunday 09 October 2005 07:50 am, phil hunt wrote: On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock [EMAIL PROTECTED] wrote: GvR's syntax has the advantage of making

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-09 Thread phil hunt
On Fri, 7 Oct 2005 01:05:12 -0500, Terry Hancock [EMAIL PROTECTED] wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as written pretty much makes sense). I know, let's re-write Python to make it more like COBOL! That's bound to be a winner! --

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Terry Hancock
On Monday 03 October 2005 03:48 am, Volker Grabsch wrote: Fredrik Lundh wrote: /... snip comment that the natural order is C, X, Y and that programmers that care about readable code will probably want to be extremely careful with this new feature .../ That's also my opinion, but

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Robin Becker
As mentioned earlier only a dictator can make such decisions and of course as with many dictatorships the wrong decision is often made. There's no such thing as a benevolent dictatorship. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Eric Nieuwland
Robin Becker wrote: As mentioned earlier only a dictator can make such decisions and of course as with many dictatorships the wrong decision is often made. There's no such thing as a benevolent dictatorship. Ever cared to check what committees can do to a language ;-) --eric --

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Michael Ekstrand
On Friday 07 October 2005 08:56, Eric Nieuwland wrote: Ever cared to check what committees can do to a language ;-) *has nasty visions of Java* Hey! Stop that! - Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Simon Brunning
On 07/10/05, Eric Nieuwland [EMAIL PROTECTED] wrote: Ever cared to check what committees can do to a language ;-) +1 QOTW. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Fredrik Lundh
Terry Hancock wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as written pretty much makes sense). as a native Python speaker, I find that argument being remarkably weak. things I write in Python should make sense in Python, not in some other

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Robin Becker
Eric Nieuwland wrote: Ever cared to check what committees can do to a language ;-) well there goes democracy :( -the happy slaves eat and are contented-ly yrs- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Terry Hancock
On Friday 07 October 2005 10:52 am, Fredrik Lundh wrote: Terry Hancock wrote: GvR's syntax has the advantage of making grammatical sense in English (i.e. reading it as written pretty much makes sense). as a native Python speaker, I find that argument being remarkably weak. things I

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Steven D'Aprano
On Fri, 07 Oct 2005 18:24:28 +0100, Robin Becker wrote: Eric Nieuwland wrote: Ever cared to check what committees can do to a language ;-) well there goes democracy :( For fans of Terry Pratchett's Discworld series, there is: Vimes had once discussed the Ephebian idea of

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Antoon Pardon
Op 2005-09-30, Sam schreef [EMAIL PROTECTED]: This is a MIME GnuPG-signed message. If you see this text, it means that your E-mail or Usenet software does not support MIME signed messages. The Internet standard for MIME PGP messages, RFC 2015, was published in 1996. To open this message

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Christophe
Michael a écrit : Rocco Moretti wrote: That is, what would happen with the following constructs: A if B else C if D else F A if B if C else D else F The correct answer should be the person who wrote it would get told off for writing code that a person reading would have no idea what

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Sion Arrowsmith
Ron Adam [EMAIL PROTECTED] wrote: So ... A if B else C + X * Y Would evaluate as... ? A if B else (C + X * Y) In general, 'if' and 'else' bind less tight than everything except lambda. http://mail.python.org/pipermail/python-dev/2005-September/056846.html -- \S -- [EMAIL PROTECTED]

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Michael
Christophe wrote: Michael a écrit : Rocco Moretti wrote: That is, what would happen with the following constructs: A if B else C if D else F A if B if C else D else F The correct answer should be the person who wrote it would get told off for writing code that a person reading would

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-02 Thread Michael
Paul Rubin wrote: I'm not sure what Guido saw in the A if C else B syntax but it's not a big deal. Maybe Guido's done some perl programming on the side? When I've been doing perl programming I've quite liked the if (...); construct, however, on occasion it's been desirable to have an else

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Ron Adam wrote: It will be A if B else (C if D else F) So this evaluates as if there are parentheses around each section.. Hmm? (A) if (B) else ( (C) if (D) else (F) ) The first 'if' divided the expr, then each succeeding 'if' divides the sub expressions, etc... ? So ...

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Erik Max Francis wrote: Dave Benjamin wrote: Hooray! After years of arguing over which syntax to use, and finally giving up since nobody could agree, the Benevolent Dictator did what only a dictator can do, and just made a damn decision already. Thank you, Guido! =) Yes, hear hear.

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Sam wrote: Jaime Wyant writes: On 9/30/05, Sam [EMAIL PROTECTED] wrote: Reinhold Birkenfeld writes: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Paul Rubin
Reinhold Birkenfeld [EMAIL PROTECTED] writes: For a conditional, syntax must be found, and the tradition of Python design is not to use punctuation for something that can be solved with keywords. Yeah, if C then A else B is a ancient tradition stretching from Algol-60 to OCAML, and who knows

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Leif K-Brooks
Sam wrote: And foo if bar is Perl-ish; yet, even Perl has the ? : operators. What _isn't_ Perl-ish? -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Sam
Leif K-Brooks writes: Sam wrote: And foo if bar is Perl-ish; yet, even Perl has the ? : operators. What _isn't_ Perl-ish? BASIC? pgp7WNg5zZz7a.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Ron Adam
Reinhold Birkenfeld wrote: Ron Adam I think I'm going to make it a habit to put parentheses around these things just as if they were required. Yes, that's the best way to make it readable and understandable. Reinhold Now that the syntax is settled, I wonder if further discussion on the

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread en.karpachov
On Fri, 30 Sep 2005 21:28:26 -0400 Terry Reedy wrote: The lesson for me is to spend much less time on Python discussion and much more on unfinished projects. So even if I never use the new syntax, I will have gained something ;-) QOTW? -- jk --

[Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Reinhold Birkenfeld
Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y, X)[bool(C)] or C and X or Y (only if X is True) Reinhold --

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Fredrik Lundh
Reinhold Birkenfeld wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y, X)[bool(C)] hopefully, only one of Y or X is actually evaluated ? C

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Richie Hindle
[Fredrik] X if C else Y hopefully, only one of Y or X is actually evaluated ? Yes. From Guido's announcement at http://mail.python.org/pipermail/python-dev/2005-September/056846.html: The syntax will be A if C else B This first evaluates C; if it is true, A is evaluated to give

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Paul Rubin
Richie Hindle [EMAIL PROTECTED] writes: Yes. From Guido's announcement at http://mail.python.org/pipermail/python-dev/2005-September/056846.html: The syntax will be A if C else B Wow, I thought this was a prank at first. Congratulations to Guido. I think the introduction of list and

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Reinhold Birkenfeld
Fredrik Lundh wrote: Reinhold Birkenfeld wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y, X)[bool(C)] hopefully, only one of Y or X is

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Rocco Moretti
Reinhold Birkenfeld wrote: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y Any word on chaining? That is, what would happen with the following constructs: A if B else C if D

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Dave Benjamin
Reinhold Birkenfeld wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y Hooray! After years of arguing over which syntax to use, and finally giving up since nobody could agree,

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Reinhold Birkenfeld
Rocco Moretti wrote: Reinhold Birkenfeld wrote: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y Any word on chaining? That is, what would happen with the following

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Erik Max Francis
Dave Benjamin wrote: Hooray! After years of arguing over which syntax to use, and finally giving up since nobody could agree, the Benevolent Dictator did what only a dictator can do, and just made a damn decision already. Thank you, Guido! =) Yes, hear hear. So what made him change his

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Sam
Reinhold Birkenfeld writes: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y, X)[bool(C)] What's wrong with C ? X:Y? Aside from : being

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Ron Adam
Reinhold Birkenfeld wrote: Rocco Moretti wrote: Reinhold Birkenfeld wrote: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y Any word on chaining? That is, what would happen with

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Jaime Wyant
On 9/30/05, Sam [EMAIL PROTECTED] wrote: Reinhold Birkenfeld writes: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y, X)[bool(C)]

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Bengt Richter
On Fri, 30 Sep 2005 20:25:35 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Reinhold Birkenfeld wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Terry Reedy
Dave Benjamin [EMAIL PROTECTED] Hooray! After years of arguing over which syntax to use, and finally giving up since nobody could agree, I understand that this has become the local 'politically correct' view, but as a participant in the discussion, I know it not true and actively deceptive.

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Sam
Jaime Wyant writes: On 9/30/05, Sam [EMAIL PROTECTED] wrote: Reinhold Birkenfeld writes: Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's (Y,