PEP-308 a "simplicity-first" alternative

Erik Max Francis max at alcyone.com
Thu Feb 13 08:18:38 CET 2003


Paul Foley wrote:

> Bleargh!

Indeed.

> I've got it!  (if x then: y else: z) with required parentheses is on
> the table -- ...

I presume you mean `(if x: y else: z)'.  `if x then y else z' was one of
the alternatives originally mentioned in the PEP, but the leading
proposal at this point does introduce a new keyword (`then').

> ... how about answering the question of whether or not there
> should be colons in there by just dropping "then:" and "else:" and
> writing simply (if x y z)?  :-))

That's an easy one:  ambiguity.

	(if test A + B - C)

Do I mean

	(if test (A + B) (-C))

or

	(if test A (+B - C))

Others, I'm sure, can come up with more clever ambiguous cases.

In the face of unary and binary operators with the same "symbol," there
_has_ to be some sort of delimiting syntax between the three
expressions; the tokens of two expressions can in some cases be
concatenated together to make a whole new expression with a completely
different meaning.


-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Nothing you have said / Is revelation
\__/ The Russian, _Chess_
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.




More information about the Python-list mailing list