[pypy-svn] r41012 - pypy/dist/pypy/lib

hpk at codespeak.net hpk at codespeak.net
Thu Mar 22 09:21:40 CET 2007


Author: hpk
Date: Thu Mar 22 09:21:39 2007
New Revision: 41012

Modified:
   pypy/dist/pypy/lib/tputil.py
Log:
niceifying repr of ProxyOperations


Modified: pypy/dist/pypy/lib/tputil.py
==============================================================================
--- pypy/dist/pypy/lib/tputil.py	(original)
+++ pypy/dist/pypy/lib/tputil.py	Thu Mar 22 09:21:39 2007
@@ -5,6 +5,7 @@
 """
 from __pypy__ import tproxy 
 from types import MethodType
+import inspect
 
 _dummy = object()
 origtype = type
@@ -60,6 +61,10 @@
         return res 
 
     def __repr__(self):
-        return "<ProxyOperation %s.%s(*%r, **%r) %x>" %(
-                    type(self.proxyobj).__name__, self.opname, 
-                    self.args, self.kwargs, id(self.proxyobj))
+        args = ", ".join([repr(x) for x in self.args])
+        args = "<0x%x>, " % id(self.proxyobj) + args 
+        if self.kwargs:
+            args += ", ".join(["%s=%r" % item 
+                                  for item in self.kwargs.items()])
+        return "<ProxyOperation %s.%s(%s)>" %(
+                    type(self.proxyobj).__name__, self.opname, args)



More information about the Pypy-commit mailing list