So I am getting the following results:
() is ()
returnsTrue
(comparison between two objects)id(()) is id(())
returnsFalse
. (comparison between the representations of object identities)
According to the python documentation:
The ‘is‘ operator compares the identity of two objects; the id() function returns an integer representing its identity.
Given case (1), object ()
has the same identity (memory address) as object ()
; but in case (2), the representations of their identities are not identical to each other.
Why is that?