and [True,True] --> [True, True]?????
Leo
Leonid_no_spams_Wang at gmail.com
Thu Apr 23 05:18:25 EDT 2009
Steven D'Aprano wrote:
> 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?
Is that true?
Calling len() actually traverses the whole list?
>
>
More information about the Python-list
mailing list