list equal to subclass of list?

Roy Smith roy at panix.com
Thu May 12 21:53:05 EDT 2011


In article <mailman.1479.1305217887.9059.python-list at python.org>,
 Ethan Furman <ethan at stoneleaf.us> wrote:

> > [http://docs.python.org/library/stdtypes.html]
> > Objects of different types, except different numeric types and different 
> > string types, never compare equal
> 
> This part of the documentation is talking about built-in types, which 
> your MyList is not.
> 
> 
> > [http://docs.python.org/release/2.7/reference/expressions.html#notin]
> > objects of different types *always* compare unequal
> 
> Should probably have the word 'built-in' precede 'types' here, since 
> constructed objects can do whatever they have been told to do.

Changing the docs (in numerous places) to make it clear that this is 
only true of built-in types would indeed resolve the problem.  As it 
reads now, it's a general statement about ALL types, built-in or 
user-defined.



More information about the Python-list mailing list