finding object using IS instead of ==

Mark Hahn mark at hahnca.com
Thu Aug 28 00:35:46 EDT 2003


Clarification: Is there a FASTER way that takes advantage of the IS
equivalence than using the available == method.  I assume the == method does
a linear search, except for a dict key lookup, which is not what I'm talking
about.

Obviously if two references are the same object (IS equivalent) then they
are == also so you could find based on == and then check for IS, but I want
something faster.

"Mark Hahn" <mark at hahnca.com> wrote in message
news:Mkf3b.7167$n94.2649 at fed1read04...
> If I have a large collection (list, tuple, or dict) of objects, can I
locate
> one quickly that matches a given object using the IS equivalence operator
> instead of the value == operator?
>
>






More information about the Python-list mailing list