On Wed, 15 Jul 2009 21:05:16 +0200, Jean-Michel Pichavant wrote: > So if I resume: > - not 'foo' => False > - 'foo' or 'foo' => 'foo' > > I may be missing something, but honestly, Guido must have smoked some > heavy stuff to write such logic, has he ?
Several languages (e.g. Lisp, Bourne shell) behave the same way, i.e. "or" returns the first element which is considered true while "and" returns the last element provided that all preceding elements are considered true. > Let's play again > False or 'foo' => 'foo' > False and 'foo' => False > > So funny. I would have expected boolean operators to return a boolean > value. In Python, almost everything is a boolean value. Compare with Lisp, where everything is a boolean value: nil (the empty list) is false and everything else (including integer zero) is true. -- http://mail.python.org/mailman/listinfo/python-list