3
Researching, I noticed that the function id() returns an integer and that guarantees to be unique and constant to the object.
When comparing two objects I got different results, which may have enabled these different results??
I observed in a booklet that the comparison id(Carro()) == id(Carro()) returns False but when executing the code the same returned True
Car Class.py
class Carro:
pass
Code in the Idle
>>> from Carro import Carro
>>> fusca = Carro()
>>> opala = Carro()
>>> id(opala) == id(fusca)
False
>>> id(Carro()) == id(Carro())
True
Good question, it was to give
False, since two distinct objects of the type are being createdCarro– Haroldo_OK
Exactly @Haroldo_ok , wait for someone to describe what may have occurred.
– Oliveira