I'm developing a program using Python 3.6
I have a problem: if I use the deterministic hash
function (from standard library of the language) on the same object, the string that results in output (after a run), is different for some runs!
For example:
class Generic:
def __init__(self, id, name, property):
self.id = id
self.name = name
self.property = property
def main():
my_object = Generic(3,'ddkdjsdk','casualstring')
print(hash(my_object))
I would like the output to always be the same (deterministic), but unfortunately different strings appear on the console: 8765256330262, -9223363264515786864, -9223363262437648366 and others... Why this happens? I would like to guarantee the determinism with this function throughout my application! How do I solve the problem?