[pypy-svn] rev 2271 - pypy/trunk/src/pypy/annotation

hpk at codespeak.net hpk at codespeak.net
Thu Nov 27 16:31:38 CET 2003


Author: hpk
Date: Thu Nov 27 16:31:37 2003
New Revision: 2271

Modified:
   pypy/trunk/src/pypy/annotation/annset.py
   pypy/trunk/src/pypy/annotation/model.py
Log:
a couple of small enhancements/bug fixes. 

also python -i annset.py allows to play around with annotations



Modified: pypy/trunk/src/pypy/annotation/annset.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/annset.py	(original)
+++ pypy/trunk/src/pypy/annotation/annset.py	Thu Nov 27 16:31:37 2003
@@ -325,3 +325,8 @@
     bool: True,
     types.FunctionType: True,
     }
+
+if __name__ == '__main__':
+    val1, val2, val3 = SomeValue(), SomeValue(), SomeValue()
+    annset = AnnotationSet()
+

Modified: pypy/trunk/src/pypy/annotation/model.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/model.py	(original)
+++ pypy/trunk/src/pypy/annotation/model.py	Thu Nov 27 16:31:37 2003
@@ -13,20 +13,20 @@
                 if isinstance(value, SomeValue):
                     _seen[id(value)] = name
             return debugname(someval)
-        name = "X%d" % len(seen)
+        name = "V%d" % len(_seen)
         _seen[id(someval)] = name
         return name
 
 class Predicate:
-    def __init__(self, name, arity):
-        self.name = name
+    def __init__(self, debugname, arity):
+        self.debugname = debugname
         self.arity = arity
     def __getitem__(self, args):
         if self.arity == 1:
             args = (args,)
         return Annotation(self, *args)
     def __str__(self):
-        return self.name
+        return self.debugname
 
 class ConstPredicate(Predicate):
     def __init__(self, value):
@@ -65,7 +65,7 @@
 
     def __repr__(self):
         return "Annotation(%s, %s)" % (
-                self.predicate, ", ".join(map(repr, self.args)))
+                self.predicate, ", ".join(map(debugname, self.args)))
 
 
 immutable_types = {


More information about the Pypy-commit mailing list