Empty string is False right?

D'Arcy J.M. Cain darcy at druid.net
Sat Jan 31 14:24:06 CET 2009

On Sat, 31 Jan 2009 12:16:19 +0000
AJ Ostergaard <aj at cubbyhole.net> wrote:
>  >>> '' and True
> ''
> Surely that should be False?!?

Why?  The first value evaluates to False in a boolean context and
thus is returned in the above statement due to short circuit
evaluation but is not itself False.  You wouldn't expect the following
statement to be True.

>>> '' is False

D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

More information about the Python-list mailing list