[pypy-svn] r7508 - pypy/trunk/src/pypy/interpreter

tismer at codespeak.net tismer at codespeak.net
Sat Nov 20 13:06:26 CET 2004


Author: tismer
Date: Sat Nov 20 13:06:25 2004
New Revision: 7508

Modified:
   pypy/trunk/src/pypy/interpreter/baseobjspace.py
   pypy/trunk/src/pypy/interpreter/function.py
Log:
a few decorations via __repr__
I don't know if this makes sense this way, but probably better than those long default names.

Modified: pypy/trunk/src/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/trunk/src/pypy/interpreter/baseobjspace.py	Sat Nov 20 13:06:25 2004
@@ -36,6 +36,9 @@
         self._gatewaycache = Cache()
         # sets all the internal descriptors
         self.initialize()
+        
+    def __repr__(self):
+        return self.__class__.__name__
 
     def make_builtins(self, for_builtins):
         "NOT_RPYTHON: only for initializing the space."

Modified: pypy/trunk/src/pypy/interpreter/function.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/function.py	(original)
+++ pypy/trunk/src/pypy/interpreter/function.py	Sat Nov 20 13:06:25 2004
@@ -25,6 +25,11 @@
         self.defs_w    = defs_w     # list of w_default's
         self.w_func_dict = space.newdict([])
 
+    def __repr__(self):
+        # return "function %s.%s" % (self.space, self.name)
+        # maybe we want this shorter:
+        return "func %s" % self.name
+
     def call_args(self, args):
         scope_w = args.parse(self.name, self.code.signature(), self.defs_w)
         frame = self.code.create_frame(self.space, self.w_func_globals,
@@ -83,6 +88,13 @@
         self.w_function = w_function
         self.w_instance = w_instance   # or None
         self.w_class = w_class
+        
+    def __repr__(self):
+        if self.w_instance:
+            pre = "bound"
+        else:
+            pre = "unbound"
+        return "%s method %s" % (pre, self.w_function.name)
 
     def call_args(self, args):
         if self.w_instance is not None:



More information about the Pypy-commit mailing list