a = b = 1 just syntactic sugar?

Erik Max Francis max at alcyone.com
Sun Jun 8 13:22:46 CEST 2003

Ed Avis wrote:

> Oh.  I thought someone said on this newsgroup only a few days ago that
> they did not, when I mentioned that
>     cond and x or y
> is a well-known substitute for a conditional operator like C's
> (cond ? x : y) or Haskell's (if cond then x else y).  Someone said
> that it wouldn't work, because x and y would be evaluated in either
> case.

No, the problem with it is that it won't work if x is false.  Think
about it.

   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ God is love, but get it in writing.
\__/  Gypsy Rose Lee

More information about the Python-list mailing list