Python Quiz
Peter Hansen
peter at engcorp.com
Wed Jul 16 11:49:15 EDT 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...
-Peter
More information about the Python-list
mailing list