checking if a list is empty

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu May 12 01:44:07 EDT 2011


Roy Smith wrote:
> Hans Georg Schaathun <hg at schaathun.net> 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.

-- 
Greg



More information about the Python-list mailing list