Say that we have a list my_num=[1,2,3,4,5]
.
Applying repr()
on that list returns a representation of this object as a string, say a=repr(my_num)
. I thought that calling my_num.__repr__()
would yield the same object.
However:
>>> my_num=[1,2,3,4,5]
>>> a=repr(my_num)
>>> a is my_num.__repr__()
False
Why is this happening?