Re: [Python-Dev] conditional expressions - add parens?

2006-03-12 Thread Guido van Rossum
On 3/11/06, Joe Smith [EMAIL PROTECTED] wrote: Well the original was almost certainly a tongue-in-cheek reference to LISP. LISP was a disaster to use, so I doubt your language would have been any worse. The way one identifies a lisp programmer is to find the person whose paren keys have worn

Re: [Python-Dev] conditional expressions - add parens?

2006-03-12 Thread Greg Ewing
Joe Smith wrote: LISP was a disaster to use, so I doubt your language would have been any worse. At least Lisp would let you say (* 4 a c) and not force you to write (* (* 4 a) c) My language would not have been so forgiving, unless you were willing to define a bunch of different *

Re: [Python-Dev] conditional expressions - add parens?

2006-03-11 Thread Joe Smith
Greg Ewing [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeremy Hylton wrote: Perhaps the solution is to require parens around all expressions, a simple consistent rule. I actually designed a language with that feature once. It was an exercise in minimality, with hardly

Re: [Python-Dev] conditional expressions - add parens?

2006-03-09 Thread Steve Holden
Morel Xavier wrote: Steve Holden wrote: Contrast with the bleeding obvious: level = 0 if absolute_import in self.futures: level = -1 regards Steve The issue that spawned the necessity of a ternary operator in the first place was that this syntax is not usable at

Re: [Python-Dev] conditional expressions - add parens?

2006-03-08 Thread Morel Xavier
Steve Holden wrote: Contrast with the bleeding obvious: level = 0 if absolute_import in self.futures: level = -1 regards Steve The issue that spawned the necessity of a ternary operator in the first place was that this syntax is not usable at all in quite a few

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Steve Holden
Joe Smith wrote: Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jim Jewett wrote: I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Jeremy Hylton
On 3/6/06, Alex Martelli [EMAIL PROTECTED] wrote: On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Paul Moore
On 3/7/06, Jeremy Hylton [EMAIL PROTECTED] wrote: On 3/6/06, Alex Martelli [EMAIL PROTECTED] wrote: On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression.

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Nick Coghlan
Paul Moore wrote: On 3/7/06, Jeremy Hylton [EMAIL PROTECTED] wrote: On 3/6/06, Alex Martelli [EMAIL PROTECTED] wrote: On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single)

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Jim Jewett
On 3/7/06, Paul Moore [EMAIL PROTECTED] wrote: The parentheses around genexps were (AFAICT) different - without them, the grammar was ambiguous, so some way of disambiguating was needed. The out-of-order evaluation is a very large change, because now we have a situation where normal parsing

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Steve Holden
Jim Jewett wrote: On 3/7/06, Paul Moore [EMAIL PROTECTED] wrote: The parentheses around genexps were (AFAICT) different - without them, the grammar was ambiguous, so some way of disambiguating was needed. The out-of-order evaluation is a very large change, because now we have a

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Alex Martelli
On Mar 7, 2006, at 7:29 AM, Steve Holden wrote: ... In fact, I think the below examples are reasonable uses that do a better job of expressing intent than the if statement would. I just don't like the mental backtrack they require, and would like some sort of advance warning.

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Greg Ewing
Paul Moore wrote: +0 for mentioning parens around conditional expressions in PEP 8. But it's aready covered by the general code should be readable in my view. Indeed. Writing readable code is ultimately the responsibility of the person doing the writing. It's enough that you *can* put

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Robert Brewer
Greg Ewing wrote: Jeremy Hylton wrote: Perhaps the solution is to require parens around all expressions, a simple consistent rule. I actually designed a language with that feature once. It was an exercise in minimality, with hardly anything built-in -- all the arithmetic operators,

[Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Jim Jewett
Now that we have started to see conditional expressions ... I would like to see them parenthesized. The parens aren't as important as they are with generator expressions, but ... they matter.From a recent checkin -- level = 0 if absolute_import in self.futures else -1Mentally, I can't help

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Thomas Wouters
On 3/6/06, Jim Jewett [EMAIL PROTECTED] wrote: From a recent checkin -- level = 0 if absolute_import in self.futures else -1Mentally, I can't help parsing that as level = 0 plus comments that turn out to be code that triggers backracking.When the expressions (particularly the true case) are

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Jim Jewett
On 3/6/06, Thomas Wouters [EMAIL PROTECTED] wrote: On 3/6/06, Jim Jewett [EMAIL PROTECTED] wrote: level = 0 if absolute_import in self.futures else -1 Mentally, I can't help parsing that as level = 0 plus comments that turn out to be code that triggers backtracking. I think that

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Steve Holden
Jim Jewett wrote: Now that we have started to see conditional expressions ... I would like to see them parenthesized. The parens aren't as important as they are with generator expressions, but ... they matter. From a recent checkin -- level = 0 if absolute_import in self.futures

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Steve Holden
Morel Xavier wrote: Steve Holden wrote: Contrast with the bleeding obvious: level = 0 if absolute_import in self.futures: level = -1 regards Steve The issue that spawned the necessity of a ternary operator in the first place was that this syntax is not

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Alex Martelli
On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures else -1) +1 (just because I can't give it

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Joe Smith
Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jim Jewett wrote: I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures else -1) Contrast

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Tim Peters
[Jim Jewett] I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures else -1) [Steve Holden] Contrast with the bleeding obvious: level = 0 if

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Fredrik Lundh
Alex Martelli wrote: On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures else -1) +1 (just because I