Whilst reading about Python's infinity, I came accross this :
>>>float('Inf') == float('Inf')
True
>>>float('Inf') is float('Inf')
False
>>>float('Inf') is not float('Inf')
True
I understand that equals works but I am wondering what float('Inf')
actually points to that make the is
test return False
? Is it different each time you call float('Inf')
?
EDIT: I am not asking about the difference between ==
and is
. I am asking about the implementation details of float('Inf')
and the nature of this object.