[pypy-svn] rev 1501 - in pypy/trunk/src/pypy: objspace/flow translator
pedronis at codespeak.net
pedronis at codespeak.net
Wed Oct 1 14:05:09 CEST 2003
Author: pedronis
Date: Wed Oct 1 14:05:08 2003
New Revision: 1501
Modified:
pypy/trunk/src/pypy/objspace/flow/wrapper.py
pypy/trunk/src/pypy/translator/flowmodel.py
Log:
add hash for SpaceOperation
moved equality to flowmodel Constant
added hash to flowmodel Constant
Modified: pypy/trunk/src/pypy/objspace/flow/wrapper.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/wrapper.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/wrapper.py Wed Oct 1 14:05:08 2003
@@ -68,9 +68,6 @@
def unwrap(self):
return self.value
- def __eq__(self, other):
- return type(other) is type(self) and self.value == other.value
-
def __len__(self):
return len(self.value)
Modified: pypy/trunk/src/pypy/translator/flowmodel.py
==============================================================================
--- pypy/trunk/src/pypy/translator/flowmodel.py (original)
+++ pypy/trunk/src/pypy/translator/flowmodel.py Wed Oct 1 14:05:08 2003
@@ -25,7 +25,13 @@
class Constant:
def __init__(self, value):
self.value = value
-
+
+ def __eq__(self, other):
+ return type(other) is type(self) and self.value == other.value
+
+ def __hash__(self):
+ return hash(self.value)
+
def __repr__(self):
return str(self.value)
@@ -41,6 +47,10 @@
self.args == other.args and
self.result == other.result)
+ def __hash__(self):
+ return hash((self.opname,tuple(self.args),self.result))
+
+
def __repr__(self):
return "%s(%s) -> %s" % (self.opname, ", ".join(map(str, self.args)), self.result)
More information about the Pypy-commit
mailing list