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

Fuzzyman fuzzyman at gmail.com
Wed Jan 18 10:09:44 EST 2006


Claudio Grondi wrote:
[snip..]> > Perhaps you could try again in English? :-) Sorry, that's a
very complex
> > sentence and it isn't clear what yo mean.
> Here in English ;-) :
> a=[1]
> ... many other statements here ...
> b=[1]
> a is b  # False
> a == b  # True
> a[0] is b[0] # unpredictable(?)
> a[0] == b[0] # True
>
> so a C, Javascript equivalent '==' operator (called here e.g. 'xx')
> should in case of code above _always_ give:
> a    xx b    # False
> a[0] xx b[0] # True
> what becomes only possible if the object holding the integer value 1 is
> created only once when a=[1] and reused when executing b=[1].
>

So you're *really* saying that you want this :

>>> a = 1
>>> b = 1
>>> a == b
False

??????

WTF

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

> Claudio




More information about the Python-list mailing list