The typical usages are if you do actually want to know if something is the same instance.
foo=TrueiffooisTrue:# True!
Also foo is None, which you've probably seen a lot of before, and useful with some constants if you're using them mostly by name, not value, like an enum type in other languages:
classenum:LEFT='Left'RIGHT='Right'foo=enum.LEFTprint(fooisenum.LEFT)# True! (And doesn't do a string comparison).
What would be a proper True "is" comparation?
Awesome topic btw.
The typical usages are if you do actually want to know if something is the same instance.
Also
foo is None, which you've probably seen a lot of before, and useful with some constants if you're using them mostly by name, not value, like an enum type in other languages:Ok now is pretty clear, so at one poin if you change the value of
footoenum.RIGHT, this would be easier than checking iffoo == "Right".Thanks for the heads up!