conditional expressions

Pedro RODRIGUEZ pedro_rodriguez at
Thu Sep 26 12:30:47 EDT 2002

On Wed, 25 Sep 2002 04:30:57 +0200, Greg Ewing wrote:

> thp at wrote:
>> But why use grotesque hacks in the first place?  "a ? b : c" is a
>> well-established syntax for conditional expressions.  Why doesn't
>> Python simply adopt it?
> I believe because Guido (a) thinks it's ugly and (b) doesn't think it
> would add enough to the language to be worth including.
> Personally, I rather like
>     a if b else c
> but Guido doesn't like that either, unfortunately.
> Perhaps I'll slip it into Pyrex when no-one's looking...:-)

Ada has two short-circuits operators : "and then" and "or else" that
do the trick :
    if A and then B then
    end if;

Looks cleaner to me.


More information about the Python-list mailing list