diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/reprlib.rst (renamed from Doc/library/repr.rst) | 13 | ||||
-rw-r--r-- | Doc/tutorial/stdlib2.rst | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/Doc/library/repr.rst b/Doc/library/reprlib.rst index 3f7fc22..84fd6fb 100644 --- a/Doc/library/repr.rst +++ b/Doc/library/reprlib.rst @@ -1,13 +1,13 @@ -:mod:`repr` --- Alternate :func:`repr` implementation +:mod:`reprlib` --- Alternate :func:`repr` implementation ===================================================== -.. module:: repr +.. module:: reprlib :synopsis: Alternate repr() implementation with size limits. .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org> -The :mod:`repr` module provides a means for producing object representations +The :mod:`reprlib` 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. @@ -62,10 +62,13 @@ which format specific object types. default is ``4`` for :attr:`maxdict`, ``5`` for :attr:`maxarray`, and ``6`` for the others. + .. versionadded:: 2.4 + :attr:`maxset`, :attr:`maxfrozenset`, and :attr:`set`. + .. attribute:: Repr.maxlong - Maximum number of characters in the representation for an integer. Digits + Maximum number of characters in the representation for a long integer. Digits are dropped from the middle. The default is ``40``. @@ -129,5 +132,5 @@ for file objects could be added:: return `obj` aRepr = MyRepr() - print(aRepr.repr(sys.stdin)) # prints '<stdin>' + print aRepr.repr(sys.stdin) # prints '<stdin>' diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index d519fc4..33bc47a 100644 --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -13,11 +13,11 @@ programming needs. These modules rarely occur in small scripts. Output Formatting ================= -The :mod:`repr` module provides a version of :func:`repr` customized for +The :mod:`reprlib` module provides a version of :func:`repr` customized for abbreviated displays of large or deeply nested containers:: - >>> import repr - >>> repr.repr(set('supercalifragilisticexpialidocious')) + >>> import reprlib + >>> reprlib.repr(set('supercalifragilisticexpialidocious')) "set(['a', 'c', 'd', 'e', 'f', 'g', ...])" The :mod:`pprint` module offers more sophisticated control over printing both |