bbayles / python-pure-cdb

Pure Python CDB reader/writer
https://python-pure-cdb.readthedocs.io/
MIT License
40 stars 10 forks source link

Deprecate using built-in hash() function #12

Closed bbayles closed 6 years ago

bbayles commented 6 years ago

As of Python 3.3:

By default, the __hash__() values of str, bytes and datetime objects are “salted” with an unpredictable random value. Although they remain constant within an individual Python process, they are not predictable between repeated invocations of Python.

This ruins reading and writing of databases; we should remove this functionality. I think cdb files created with Python 2 on different platforms (e.g. 32-bit or ARM) would have a similar issue.

Notes:

dw commented 6 years ago

+1

don't think anyone uses it, I just wanted to see how far the code could be pushed perfwise. RIP hash() :)