<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>3.22 repr --
Alternate repr() implementation.</TITLE>
<META NAME="description" CONTENT="3.22 repr --
Alternate repr() implementation.">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="lib.css">
<LINK REL="next" HREF="module-pycompile.html">
<LINK REL="previous" HREF="module-pprint.html">
<LINK REL="up" HREF="python.html">
<LINK REL="next" HREF="Repr-objects.html">
</HEAD>
<BODY bgcolor="#ffffff">
<div class=navigation>
<table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="Repr-objects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="python.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="PrettyPrinter_Objects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python Library Reference</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="Repr-objects.html">3.22.1 Repr Objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="python.html">3. Python Services</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="PrettyPrinter_Objects.html">3.21.1 PrettyPrinter Objects</A></span>
<br><hr></div>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0052200000000000000000">
3.22 <tt class=module>repr</tt> --
         Alternate <tt class=function>repr()</tt> implementation.</A>
</H1>

<P>



<P>
The <tt class=module>repr</tt> 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.

<P>
This module provides a class, an instance, and a function:

<P>
<dl><dt><b><a name="l2h-535"><tt class=class>Repr</tt></a></b> ()
<dd>
  Class which provides formatting services useful in implementing
  functions similar to the built-in <tt class=function>repr()</tt>; size limits for 
  different object types are added to avoid the generation of
  representations which are excessively long.
</dl>

<P>
<dl><dt><b><a name="l2h-536"><tt>aRepr</tt></a></b>
<dd>
  This is an instance of <tt class=class>Repr</tt> which is used to provide the
  <tt class=function>repr()</tt> function described below.  Changing the attributes
  of this object will affect the size limits used by <tt class=function>repr()</tt>
  and the Python debugger.
</dl>

<P>
<dl><dt><b><a name="l2h-537"><tt class=function>repr</tt></a></b> (<var>obj</var>)
<dd>
  This is the <tt class=method>repr()</tt> method of <tt>aRepr</tt>.  It returns a
  string similar to that returned by the built-in function of the same 
  name, but with limits on most sizes.
</dl>

<P>

<p><hr>
<!--Table of Child-Links-->


<UL>
<LI><A NAME="tex2html1330"
 HREF="Repr-objects.html">3.22.1 Repr Objects </A>
<LI><A NAME="tex2html1331"
 HREF="subclassing-reprs.html">3.22.2 Subclassing Repr Objects </A>
</UL>
<!--End of Table of Child-Links-->
<p>
<div class=navigation><hr><table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="Repr-objects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="python.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="PrettyPrinter_Objects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python Library Reference</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="Repr-objects.html">3.22.1 Repr Objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="python.html">3. Python Services</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="PrettyPrinter_Objects.html">3.21.1 PrettyPrinter Objects</A></span>
</div>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>Send comments on this document to <a href="mailto:python-docs@python.org">python-docs@python.org</a>.
</ADDRESS>
</BODY>
</HTML>
