and [True,True] --> [True, True]?????

Lie Ryan lie.1296 at gmail.com
Fri Apr 24 02:50:01 EDT 2009


Gerhard Häring wrote:
> len() make it clear
> that the argument is a sequence.

Not necessarily. Classes that overrides __len__ may fool that assumption 
(well, in python classes that overrides special functions may do 
anything it is never intended to do).

I often think an "if item:" as "is item workable?". What the exact 
definition of "workable" is just something I don't care, at least until 
I need to debug the code. A container is workable if it contains 
something; most of the time, an empty sequence does not have any value 
(pun intended) and thus unworkable.



More information about the Python-list mailing list