Hello,

I am testing object identity.

If I do it from the interpreter, I get strange results.

>>> print [] is []
False

>>> print id([]), id([])
3083942700 3083942700



Why is that? Isn't this an error?


If I test it in a script, all is OK.

#!/usr/bin/python

a = []
b = []

print a == b
print a is b

print id(a), id(b)

print id(None), id(None)
print id(True), id(True)


On my computer, I got these results:

True
False
3083769036 3083793516
135553336 135553336
135526444 135526444

All as expected.


jan bodnar


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to