Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: numpy/numpy
...
head fork: numpy/numpy
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 28, 2013
Charles Harris charris BUG: Set __hash__ = None for non-hashable classes.
Because neither poly1d nor the Polynomial package polynomial classes are
immutable, hence not reliably hashable, they should signal that by
setting __hash__ = None. This also fixes the warning

Overriding __eq__ blocks inheritance of __hash__ in 3.x

that is given when the command `python2.7 -3 -c"import numpy"` is run.
e2675e3
Commits on Sep 04, 2013
Charles Harris charris Merge pull request #3657 from charris/add-hash-method-to-polynomials
BUG: Set __hash__ = None for non-hashable classes.
573b3b0
Showing with 4 additions and 0 deletions.
  1. +2 −0  numpy/lib/polynomial.py
  2. +2 −0  numpy/polynomial/polytemplate.py
2  numpy/lib/polynomial.py
View
@@ -1030,6 +1030,8 @@ class poly1d(object):
coeffs = None
order = None
variable = None
+ __hash__ = None
+
def __init__(self, c_or_r, r=0, variable=None):
if isinstance(c_or_r, poly1d):
for key in c_or_r.__dict__.keys():
2  numpy/polynomial/polytemplate.py
View
@@ -79,6 +79,8 @@ class $name(pu.PolyBase) :
window = np.array($domain)
# Don't let participate in array operations. Value doesn't matter.
__array_priority__ = 1000
+ # Not hashable
+ __hash__ = None
def has_samecoef(self, other):
"""Check if coefficients match.

No commit comments for this range

Something went wrong with that request. Please try again.