oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #00936
Hash method
Hello,
As we talked this week, we need to correct some parts of some Information
Models we are implementing. Sergio suggested that we implemented the
__hash__ method in some classes. I was studying about this method (
http://docs.python.org/reference/datamodel.html#object.__hash__), and I saw
that if we are writing a mutable class, we shouldn't override __hash__
method. Apparently, classes like EhrAccess and EhrStatus are mutable
classes, right? We can change their properties, so it would be hard to
calculate their hashcode. What do you think about it?
Changing the subject, in python the operator != isn't the negation of ==. So
if we are going to implement the __eq__ method it would be interesting to
implement the __ne__ method too.
Cheers,
Wagner F. Mezaroba.
Follow ups