[pypy-svn] r17499 - pypy/dist/pypy/rpython
pedronis at codespeak.net
pedronis at codespeak.net
Mon Sep 12 16:06:33 CEST 2005
Author: pedronis
Date: Mon Sep 12 16:06:28 2005
New Revision: 17499
Modified:
pypy/dist/pypy/rpython/lltype.py
pypy/dist/pypy/rpython/rmodel.py
Log:
use the short name of the lltype name for the default Repr repr.
stop-gap for now, will need a different approach in annlowlevel to have more control and some more precise __repr__
for Reprs here and there.
Modified: pypy/dist/pypy/rpython/lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltype.py (original)
+++ pypy/dist/pypy/rpython/lltype.py Mon Sep 12 16:06:28 2005
@@ -70,6 +70,9 @@
def __str__(self):
return self.__class__.__name__
+ def _short_name(self):
+ return str(self)
+
def _defl(self, parent=None, parentindex=None):
raise NotImplementedError
@@ -172,6 +175,9 @@
return "%s %s { %s }" % (self.__class__.__name__,
self._name, self._str_fields())
+ def _short_name(self):
+ return "%s %s" % (self.__class__.__name__, self._name)
+
def _defl(self, parent=None, parentindex=None):
return _struct(self, parent=parent, parentindex=parentindex)
@@ -236,6 +242,10 @@
return "%s of %s " % (self.__class__.__name__,
self._str_fields(),)
+ def _short_name(self):
+ return "%s of %s " % (self.__class__.__name__,
+ self.OF._short_name(),)
+
def _container_example(self):
return _array(self, 1)
@@ -260,6 +270,10 @@
args = ', '.join(map(str, self.ARGS))
return "Func ( %s ) -> %s" % (args, self.RESULT)
+ def _short_name(self):
+ args = ', '.join([ARG._short_name() for ARG in self.ARGS])
+ return "Func ( %s ) -> %s" % (args, self.RESULT._short_name)
+
def _container_example(self):
def ex(*args):
return self.RESULT._defl()
@@ -357,6 +371,10 @@
def __str__(self):
return '* %s' % (self.TO, )
+
+ def _short_name(self):
+ return 'Ptr to %s' % (self.TO._short_name(), )
+
def _defl(self, parent=None, parentindex=None):
return _ptr(self, None)
Modified: pypy/dist/pypy/rpython/rmodel.py
==============================================================================
--- pypy/dist/pypy/rpython/rmodel.py (original)
+++ pypy/dist/pypy/rpython/rmodel.py Mon Sep 12 16:06:28 2005
@@ -27,7 +27,7 @@
_initialized = setupstate.NOTINITIALIZED
def __repr__(self):
- return '<%s %s>' % (self.__class__.__name__, self.lowleveltype)
+ return '<%s %s>' % (self.__class__.__name__, self.lowleveltype._short_name())
def setup(self):
""" call _setup_repr() and keep track of the initializiation
More information about the Pypy-commit
mailing list