GNU Info

Info Node: (python2.1-lib.info)repr

(python2.1-lib.info)repr


Next: new Prev: pprint Up: Python Runtime Services
Enter node , (file) or (file)node

Alternate `repr()' implementation
=================================

This manual section was written by Fred L. Drake, Jr. <fdrake@acm.org>.
Alternate `repr()' implementation with size limits.

The `repr' module provides a means for producing object representations
with limits on the size of the resulting strings.  This is used in the
Python debugger and may be useful in other contexts as well.

This module provides a class, an instance, and a function:

`Repr()'
     Class which provides formatting services useful in implementing
     functions similar to the built-in `repr()'; size limits for
     different object types are added to avoid the generation of
     representations which are excessively long.

`aRepr'
     This is an instance of `Repr' which is used to provide the
     `repr()' function described below.  Changing the attributes of
     this object will affect the size limits used by `repr()' and the
     Python debugger.

`repr(obj)'
     This is the `repr()' method of `aRepr'.  It returns a string
     similar to that returned by the built-in function of the same
     name, but with limits on most sizes.

Repr Objects
Subclassing Repr Objects

automatically generated by info2www version 1.2.2.9