Can a simple a==b 'hang' in and endless loop?

Fuzzyman fuzzyman at gmail.com
Wed Jan 18 10:22:30 EST 2006


Oops... my misreading, sorry.

The reason that, in Python, short ints have the same identity is not
fickle - it's just True. Python creates a new reference (pointer) to
the same object.

You're saying you want one comparison operator that for :

> a=[1]
> ... many other statements here ...
> b=[1]

gives the result :

> a    xx b    # False
> a[0] xx b[0] # True

What you're saying is that you don't consider a and b equal when they
are container objects of the same type, with the same contents. That's
very counter intuitive.

All the best,


Fuzzyman
http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list