ilanschnell/bitarray — pull request #16 by subbyte (2013-11-02 21:54:54+00:00)
Title: New Feature: __hash__()

I find bitarray is not able to be used as a dictionary key due to the missing __hash__() method. So I implement it.

I refer to PyLongObject to create a hash function for bitarray on both Python2.x and Python3.x.
The output of the hash is the standard Py_hash_t type. All missing types and MACROs on Python2.x are defined with the conditional compilation tag.

The new function passes the tests on Python3.3.2 and Python2.7.5 on my x86_64 machine. Python 2.6.9 environment is manually checked but haven't been tested.