Python Quiz

Peter Hansen peter at
Wed Jul 16 17:49:15 CEST 2003

Grant Edwards wrote:
> Though I was recently surprised
> that the remove() method for lists uses "==" and not "is" to
> determine what to remove.  It's documented that it works that
> way. But, it wasn't what I excpected, and it took me a while to
> figure out that it was using my class's __cmp__ method rather
> than the object ID.

Probably a very good thing, considering what would happen if 
you were trying to remove strings from the list, rather than
simple things like integers...


More information about the Python-list mailing list