Python Quiz

Grant Edwards grante at visi.com
Wed Jul 16 14:26:56 EDT 2003


In article <3F1573FB.8ADBE587 at engcorp.com>, Peter Hansen 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...

I didn't mean to imply that the way it's done isn't a good
idea, or that what I expected wasn't a bad idea.  It's just
novel to be surprised by Python -- which wasn't the case with
FORTRAN.

-- 
Grant Edwards                   grante             Yow!  My nose feels like a
                                  at               bad Ronald Reagan movie...
                               visi.com            




More information about the Python-list mailing list