checking if a list is empty

Roy Smith roy at panix.com
Thu May 12 07:36:27 EDT 2011


In article <931adaF9g1U1 at mid.individual.net>,
 Gregory Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Roy Smith wrote:
> >>If both are numbers, they are converted to a common type. Otherwise, 
> >>objects of different types always compare unequal
> 
> That's just the default treatment for unrelated types that don't
> know anything about each other.
> 
> I would guess that the list's == method is asking "Is the
> other object a list?", and since a subclass of list is also
> a list, it's happy and goes on to compare the elements.

Well, that explains what's happening, but the behavior still doesn't 
match the docs.  Is this a bug or are the docs wrong?



More information about the Python-list mailing list