[Info] PEP 308 accepted - new conditional expressions

Piet van Oostrum piet at cs.uu.nl
Wed Oct 12 07:02:20 EDT 2005


>>>>> Paul Rubin <http://phr.cx@NOSPAM.invalid> (PR) wrote:

>PR> Reinhold Birkenfeld <reinhold-birkenfeld-nospam at wolke7.net> writes:
>>> For a conditional, syntax must be found, and the tradition of Python
>>> design is not to use punctuation for something that can be solved with
>>> keywords.

>PR> Yeah, "if C then A else B" is a ancient tradition stretching from
>PR> Algol-60 to OCAML, and who knows what all else in between.  I'm not
>PR> sure what Guido saw in the "A if C else B" syntax but it's not a big deal.

I suspect it is because "if C then A else B" gives problems in the parser
because it would have difficulty to distinguish this in time from the if
statement. This is because the parser doesn't use a very strong formalism. 

I think language design should prevail over parsing problems, but in this
case it is probably a pragmatic argument that wins.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list