Python "and" behavior

Duncan Booth duncan.booth at invalid.invalid
Fri Aug 14 12:26:55 CEST 2009

MRAB <python at> wrote:

> Operation      Result
>|x or y|      x if x else y
>|x and y|      y if x else x
>|not x|      False if x else False

That's not a terribly good definition for the 'not' operator. Try:

  |not x| False if x else True

Duncan Booth

More information about the Python-list mailing list