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-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

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 har

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

2006-03-09 Thread Jiwon Seo
With parentheses, we can use "if cond then val1 else val2" form without the burden of hacking the parser, although the cost of the keyword "then" is still there. so, some possible forms that prompts in my mind are level = (if "absolute_import" in self.future then 0 else -1) level = (if "ab

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 s

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 quit

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 opera

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 par

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

2006-03-07 Thread Greg Ewing
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, etc. were defined in the lang

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 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 h

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 parsi

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 jus

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 (sin

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

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_imp

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 (ju

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 >>

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 -

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 +3.1415

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

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

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.

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) a

[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 hel