Empty string is False right?

John Machin sjmachin at lexicon.net
Sat Jan 31 13:43:25 CET 2009

On Jan 31, 11:16 pm, AJ Ostergaard <a... at cubbyhole.net> wrote:
> Hi Ralf,
> Thanks for that but why:
>  >>> '' and True
> ''
> Surely that should be False?!?

No, deliberately not. Read this for Python 3.0
and/or this for Python 2.X
[essentially the only difference in 3.0 is a change to the protocol
that allows a non-builtin object to say whether it is true or false]

More information about the Python-list mailing list