PEP-308 a "simplicity-first" alternative

Erik Max Francis max at alcyone.com
Tue Feb 11 20:52:43 EST 2003


Paul Rubin wrote:

> I intensely dislike "x and y else z".  "Explicit is better than
> implicit" to me specifically means avoiding this type of cutesy
> overloading.

I agree, although perhaps not as intensely as you do.  It's clearly a
compromise that tips its hat to the `C and x or y' broken hack, which in
and of itself does not lend itself to easy comprehension.  (It's an
idiom; if you don't know the idiom and encounter it in real code, you'll
be stuck figuring it out.)

The `and' there doesn't really give you a clue as to what's going on
(and, as someone else pointed out, what happens when this construct
appears in an expression involving more `and' operators?).  If you
really want this, then `C then x else y' seems a far better way to do
it, despite the flaw of adding an additional keyword.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Being in love for real / It ain't like a movie screen
\__/ India Arie
    Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
 A personal guide to Aliens vs. Predator 2.




More information about the Python-list mailing list