__cmp__ behaviour

Moshe Zadka moshez at math.huji.ac.il
Sat May 27 12:05:47 EDT 2000


On Sat, 27 May 2000, Emile van Sebille wrote:

> Hi all,
> 
> I have a situation where I want class instances to always
> compare unequal.  I thought I could do it with __cmp__,
> but it appears that it sometimes is short circuited.  Is
> there a way around this?

No. Python first checks for "x is y"

IOW, after  "a = b", "a == b" will always be true. 
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list