[NumPy-Tickets] [NumPy] #1127: Make the dtype object immutable and not coerce other types when compared (hashable requirements) (was: dtype is shared across structured arrays copies)
NumPy Trac
numpy-tickets@scipy....
Thu Mar 24 17:30:54 CDT 2011
#1127: Make the dtype object immutable and not coerce other types when compared
(hashable requirements)
------------------------+---------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: needs_decision
Priority: normal | Milestone: 2.0.0
Component: numpy.core | Version: devel
Keywords: |
------------------------+---------------------------------------------------
Changes (by mwiebe):
* version: => devel
* milestone: 1.5.1 => 2.0.0
Comment:
This is the PyArray_Descr object, which implements the __hash__ method.
From http://docs.python.org/glossary.html, below is the definition of
hashable. To be correct, the dtype object should be made immutable and
should not coerce other types to dtype during comparisons.
==hashable==
An object is hashable if it has a hash value which never changes during
its lifetime (it needs a __hash__() method), and can be compared to other
objects (it needs an __eq__() or __cmp__() method). Hashable objects which
compare equal must have the same hash value.
Hashability makes an object usable as a dictionary key and a set member,
because these data structures use the hash value internally.
All of Python’s immutable built-in objects are hashable, while no mutable
containers (such as lists or dictionaries) are. Objects which are
instances of user-defined classes are hashable by default; they all
compare unequal, and their hash value is their id().
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1127#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list