Skip to content

Commit

Permalink
Deprecate HashableNumpyArray
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Jul 8, 2021
1 parent 16bd4f2 commit d0b2d4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes.d/408.removal
@@ -0,0 +1 @@
Deprecate HashableNumpyArray due to its inconsistency.
6 changes: 6 additions & 0 deletions qupulse/utils/types.py
Expand Up @@ -364,10 +364,16 @@ def __init__(cls, name, bases, dct):
class HashableNumpyArray(numpy.ndarray):
"""Make numpy arrays hashable.
Deprecated since 0.6. This is a bad idea.
Example usage:
my_array = np.zeros([1, 2, 3, 4])
hashable = my_array.view(HashableNumpyArray)
"""
def __array_finalize__(self, obj):
warnings.warn("HashableNumpyArray is deprecated since qupulse 0.6 and will be removed in the next release.",
category=DeprecationWarning, stacklevel=2)

def __hash__(self):
return hash(self.tobytes())

Expand Down

0 comments on commit d0b2d4a

Please sign in to comment.