V
vronskij
Hello,
I am testing object identity.
If I do it from the interpreter, I get strange results.
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
I am testing object identity.
If I do it from the interpreter, I get strange results.
3083942700 3083942700Falseprint [] is []
print id([]), id([])
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