[Tutor] is gotchas?

Kent Johnson kent37 at tds.net
Tue Nov 7 12:04:02 CET 2006


wesley chun wrote:
>> 3)is there a special method for `is'.
> 
> no, not really. you can use id() and '==' to proxy for is:
> 
> a is b <==> id(a) == id(b)

No, not necessarily. id's are recycled which can lead to unexpected 
behaviour when comparing them. See for example this thread on c.l.py:
http://tinyurl.com/yflknx

Kent



More information about the Tutor mailing list