When implementing a custom equality function for a class, does it make sense to check for identity first? An example:
def __eq__(self, other):
return (self is other) or (other criteria)
This interesting is for cases when the other criteria may be more expensive (e.g. comparing some long strings).
necesarry: no
does it make sense: sure, why not?
No such check is done by default, as you can see here: