PEP 308: Pep Update

Kim Petersen kp at kyborg.dk
Thu Feb 27 09:50:50 EST 2003


Norman Petry wrote:
> On Thu, 27 Feb 2003 14:51:03 +1300, Greg Ewing (using news.cis.dfn.de)
> wrote:
> 
> 1) it uses symbols, rather than keywords, which are meaningless unless the
> reader is already familiar with the construct from another programming
> language (since they have no obvious analogue in mathematics or some
> natural language).  This makes it an especially poor choice for Python,
> which has important applications as a teaching (i.e. first) language.

We're programmers - theres already a load of symbols that has to be 
learned, that should not be an issue (and btw. i've programmed Cobol and 
i kinda like some of the style - but python is not and should not walk 
down that road - imho.)

> 2) it is arbitrary, in that nothing about the syntax would suggest that

it evaluates from left to right - which does make a lot of sense in 
every other context.

> 3) it is confusing, since using the colon to separate alternatives would

This one i can buy.

> 4) it is somewhat illogical to have the condition appear at the beginning

sorry this one i can't buy - your comparing apples and boot's - ?: *is* 
infix - it just uses *3* things - not *2*.

> After reading the hundreds of postings on this topic, I still feel that
> the syntax shown in the original version of the PEP (x if C else y) is the
> only one with any real merit.  It offers many advantages:

This one would confuse the heck out of me - just as the perl equivalent 
does:

<statement> if <expression> - Yikes!

if statements are:
if <expression> [optional keyword] <statement/expression> ...

> The objections to the 'x if C else y' syntax have all been very weak,
> imho.  Most people who have criticised the proposal have done little more
> than to point out that the condition appears in the middle of the
> expression (unlike C, which presumably does things the "right" way).  Of

see above...

For my vote - i'd accept anything other than x if cond else y

my favorite during these discussions has been cond -> (true,false) - but 
i guess that one won't go far....


> --
> Norman Petry

-- 
Med Venlig Hilsen / Regards

Kim Petersen - Kyborg A/S
IT - Innovationshuset
Havnepladsen 2
7100 Vejle
Tlf. +4576408183 || Fax. +4576408188





More information about the Python-list mailing list