checking if a list is empty

Ben Finney ben+python at benfinney.id.au
Sat May 14 19:26:59 EDT 2011


rusi <rustompmody at gmail.com> writes:

> [Steven quote]
> In Python, [1, 2, 3] is another way of writing true, and [] is another
> way of writing false. Similarly with any other arbitrary objects. The
> only things that bools True and False are good for are:
> <snipped>
> [end Steven quote]
> ------------------------
>
> So since
> [1,2,3] is one way of writing True (lets call it True3)

No. Steven knew exactly why he was using “true” versus “True”. He's
explained why elsewhere in this thread. The former does not refer to the
Python boolean singleton, the latter does.

The only object that is True is the True singleton. But there are many
objects that are true.

-- 
 \         “I got up the other day, and everything in my apartment has |
  `\   been stolen and replaced with an exact replica.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list