Empty string is False right?

John Machin sjmachin at lexicon.net
Sat Jan 31 07:32:16 EST 2009


On Jan 31, 11:12 pm, Ralf Schoenian <r... at schoenian-online.de> wrote:

> yes, the following evaluates to False:

A much better way of describing the effect would be to say that the
following are treated as false (no capital letter!) in a conditional
context.

> empty String: ''
> empty list: []
> empty tuple: ()
> empty dict: {}

*any* empty container ...

> 0, None
> and False of course

and objects which adhere to the protocol



More information about the Python-list mailing list