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

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Mon Apr 20 22:44:40 EDT 2009


On Mon, 20 Apr 2009 15:13:15 -0500, Grant Edwards wrote:


> I fail to see the difference between "length greater than 0" and "list
> is not empty".  They are, by definition, the same thing, aren't they?

For built-in lists, but not necessarily for arbitrary list-like sequences.

There's also the performance issue. I might have a sequence-like 
structure where calling len() takes O(N**2) time, (say, a graph) but 
calling __nozero__ might be O(1). Why defeat the class designer's 
optimizations?


-- 
Steven



More information about the Python-list mailing list