Searching, I noticed that the id()
function returns an integer and ensures that it is unique and constant for the object.
When comparing two objects I get different results, what may have made these different results possible?
I noticed in a book that the comparison id(Carro()) == id(Carro())
returns False
but when executing the code it returned True
Car.py class
class Carro:
pass
Idle code
>>> from Carro import Carro
>>> fusca = Carro()
>>> opala = Carro()
>>> id(opala) == id(fusca)
False
>>> id(Carro()) == id(Carro())
True