Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-new.html" /> | |
13 | <link rel="prev" href="module-pprint.html" /> | |
14 | <link rel="parent" href="python.html" /> | |
15 | <link rel="next" href="Repr-objects.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>3.28 repr -- Alternate repr() implementation</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="3.27.1 PrettyPrinter Objects" | |
25 | href="node96.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="3. Python Runtime Services" | |
28 | href="python.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="3.28.1 Repr Objects" | |
31 | href="Repr-objects.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="node96.html">3.27.1 PrettyPrinter Objects</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="Repr-objects.html">3.28.1 Repr Objects</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0052800000000000000000"> | |
56 | 3.28 <tt class="module">repr</tt> -- | |
57 | Alternate <tt class="function">repr()</tt> implementation</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | ||
62 | <A NAME="module-repr"></A> | |
63 | ||
64 | <P> | |
65 | The <tt class="module">repr</tt> module provides a means for producing object | |
66 | representations with limits on the size of the resulting strings. | |
67 | This is used in the Python debugger and may be useful in other | |
68 | contexts as well. | |
69 | ||
70 | <P> | |
71 | This module provides a class, an instance, and a function: | |
72 | ||
73 | <P> | |
74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
75 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-776' xml:id='l2h-776' class="class">Repr</tt></b>(</nobr></td> | |
76 | <td><var></var>)</td></tr></table></dt> | |
77 | <dd> | |
78 | Class which provides formatting services useful in implementing | |
79 | functions similar to the built-in <tt class="function">repr()</tt>; size limits for | |
80 | different object types are added to avoid the generation of | |
81 | representations which are excessively long. | |
82 | </dl> | |
83 | ||
84 | <P> | |
85 | <dl><dt><b><tt id='l2h-777' xml:id='l2h-777'>aRepr</tt></b></dt> | |
86 | <dd> | |
87 | This is an instance of <tt class="class">Repr</tt> which is used to provide the | |
88 | <tt class="function">repr()</tt> function described below. Changing the attributes | |
89 | of this object will affect the size limits used by <tt class="function">repr()</tt> | |
90 | and the Python debugger. | |
91 | </dd></dl> | |
92 | ||
93 | <P> | |
94 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
95 | <td><nobr><b><tt id='l2h-778' xml:id='l2h-778' class="function">repr</tt></b>(</nobr></td> | |
96 | <td><var>obj</var>)</td></tr></table></dt> | |
97 | <dd> | |
98 | This is the <tt class="method">repr()</tt> method of <code>aRepr</code>. It returns a | |
99 | string similar to that returned by the built-in function of the same | |
100 | name, but with limits on most sizes. | |
101 | </dl> | |
102 | ||
103 | <P> | |
104 | ||
105 | <p><br /></p><hr class='online-navigation' /> | |
106 | <div class='online-navigation'> | |
107 | <!--Table of Child-Links--> | |
108 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> | |
109 | ||
110 | <UL CLASS="ChildLinks"> | |
111 | <LI><A href="Repr-objects.html">3.28.1 Repr Objects</a> | |
112 | <LI><A href="subclassing-reprs.html">3.28.2 Subclassing Repr Objects</a> | |
113 | </ul> | |
114 | <!--End of Table of Child-Links--> | |
115 | </div> | |
116 | ||
117 | <DIV CLASS="navigation"> | |
118 | <div class='online-navigation'> | |
119 | <p></p><hr /> | |
120 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
121 | <tr> | |
122 | <td class='online-navigation'><a rel="prev" title="3.27.1 PrettyPrinter Objects" | |
123 | href="node96.html"><img src='../icons/previous.png' | |
124 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
125 | <td class='online-navigation'><a rel="parent" title="3. Python Runtime Services" | |
126 | href="python.html"><img src='../icons/up.png' | |
127 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
128 | <td class='online-navigation'><a rel="next" title="3.28.1 Repr Objects" | |
129 | href="Repr-objects.html"><img src='../icons/next.png' | |
130 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
131 | <td align="center" width="100%">Python Library Reference</td> | |
132 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
133 | href="contents.html"><img src='../icons/contents.png' | |
134 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
135 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
136 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
137 | <td class='online-navigation'><a rel="index" title="Index" | |
138 | href="genindex.html"><img src='../icons/index.png' | |
139 | border='0' height='32' alt='Index' width='32' /></A></td> | |
140 | </tr></table> | |
141 | <div class='online-navigation'> | |
142 | <b class="navlabel">Previous:</b> | |
143 | <a class="sectref" rel="prev" href="node96.html">3.27.1 PrettyPrinter Objects</A> | |
144 | <b class="navlabel">Up:</b> | |
145 | <a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A> | |
146 | <b class="navlabel">Next:</b> | |
147 | <a class="sectref" rel="next" href="Repr-objects.html">3.28.1 Repr Objects</A> | |
148 | </div> | |
149 | </div> | |
150 | <hr /> | |
151 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
152 | </DIV> | |
153 | <!--End of Navigation Panel--> | |
154 | <ADDRESS> | |
155 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
156 | </ADDRESS> | |
157 | </BODY> | |
158 | </HTML> |