I run:
Python 2.7.8 (default, Oct 6 2017, 09:25:50)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
According to the documents :
Operators is
and is not
verify the identity of the object: x is y
is True
if and only if, when x
, and y
- this is one and the same object.
To get the identifier of an object, we can use the function id
If we open a new REPL, we will see that 300
they -6
have the same identifier (on CPython this means that both refer to the same memory address):
>>> id(300)
94766593705400
>>> id(-6)
94766593705400
Please note that actual values may differ from performance to performance, but they are always equal.
However, execution 300 is -6
gives False
:
>>> 300 is -6
False
I have a couple of questions:
- ( )
300
-6
? - ,
300 is -6
False
?