Too much code - slicing

Antoon Pardon Antoon.Pardon at
Mon Sep 20 19:28:49 CEST 2010

On Sun, Sep 19, 2010 at 11:30:32PM +0000, Seebs wrote:
> On 2010-09-19, MRAB <python at> wrote:
> > On 19/09/2010 22:32, Seebs wrote:
> >> On 2010-09-19, AK<andrei.avk at>  wrote:
> >>> Because that's what 'if' and 'else' mean.
> >> My point is, I don't want the order of the clauses in if/else to change.
> >> If it is sometimes "if<condition>  <true-clause>  else<false-clause>", then
> >> it should *ALWAYS WITHOUT EXCEPTION* be condition first, then true clause,
> >> then false clause.  If it's sometimes "if condition true-clause else
> >> false-clause", and sometimes "true-clause if condition else false-clause",
> >> that's a source of extra complexity.
> >
> > [snip]
> > Have you read PEP 308? There was a lot of discussion about it.
> Interesting, in the historical section we see:
>   The original version of this PEP proposed the following syntax:
> 	<expression1> if <condition> else <expression2>
> 	The out-of-order arrangement was found to be too uncomfortable
> 	for many of participants in the discussion; especially when
> 	<expression1> is long, it's easy to miss the conditional while
> 	skimming.
> But apparently those objections were either unknown or disregarded when
> the syntax was later adopted.

Not necessarily. Some of us have the impression that Guido deliberatly
chose an ugly format for the ternary operator. Guido has alwasys been
against a ternary operator but the requests kept coming. So eventually
he introduced one. But the impression is that he chose an ugly format
in the hope of discouraging people to use it.

Antoon Pardon

More information about the Python-list mailing list