Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
473f1642
Kaydet (Commit)
473f1642
authored
Mar 22, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make more doctests in pprint docs testable.
üst
6199e32a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
pprint.rst
Doc/library/pprint.rst
+12
-17
No files found.
Doc/library/pprint.rst
Dosyayı görüntüle @
473f1642
...
@@ -49,14 +49,14 @@ The :mod:`pprint` module defines one class:
...
@@ -49,14 +49,14 @@ The :mod:`pprint` module defines one class:
the depth of the objects being formatted. The desired output width is
the depth of the objects being formatted. The desired output width is
constrained using the *width* parameter; the default is 80 characters. If a
constrained using the *width* parameter; the default is 80 characters. If a
structure cannot be formatted within the constrained width, a best effort will
structure cannot be formatted within the constrained width, a best effort will
be made.
::
be made.
>>> import pprint
>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff[:])
>>> stuff.insert(0, stuff[:])
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(stuff)
>>> pp.pprint(stuff)
[ ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
[ [
'spam', 'eggs', 'lumberjack', 'knights', 'ni'],
'spam',
'spam',
'eggs',
'eggs',
'lumberjack',
'lumberjack',
...
@@ -89,19 +89,18 @@ The :class:`PrettyPrinter` class supports several derivative functions:
...
@@ -89,19 +89,18 @@ The :class:`PrettyPrinter` class supports several derivative functions:
newline. If *stream* is omitted, ``sys.stdout`` is used. This may be used in
newline. If *stream* is omitted, ``sys.stdout`` is used. This may be used in
the interactive interpreter instead of a :keyword:`print` statement for
the interactive interpreter instead of a :keyword:`print` statement for
inspecting values. *indent*, *width* and *depth* will be passed to the
inspecting values. *indent*, *width* and *depth* will be passed to the
:class:`PrettyPrinter` constructor as formatting parameters.
::
:class:`PrettyPrinter` constructor as formatting parameters.
>>> import pprint
>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff)
>>> stuff.insert(0, stuff)
>>> pprint.pprint(stuff)
>>> pprint.pprint(stuff)
[<Recursion on list with id=869440>,
[<Recursion on list with id=...>,
'',
'spam',
'/usr/local/lib/python1.5',
'eggs',
'/usr/local/lib/python1.5/test',
'lumberjack',
'/usr/local/lib/python1.5/sunos5',
'knights',
'/usr/local/lib/python1.5/sharedmodules',
'ni']
'/usr/local/lib/python1.5/tkinter']
.. versionchanged:: 2.4
.. versionchanged:: 2.4
The parameters *indent*, *width* and *depth* were added.
The parameters *indent*, *width* and *depth* were added.
...
@@ -113,7 +112,7 @@ The :class:`PrettyPrinter` class supports several derivative functions:
...
@@ -113,7 +112,7 @@ The :class:`PrettyPrinter` class supports several derivative functions:
Determine if the formatted representation of *object* is "readable," or can be
Determine if the formatted representation of *object* is "readable," or can be
used to reconstruct the value using :func:`eval`. This always returns ``False``
used to reconstruct the value using :func:`eval`. This always returns ``False``
for recursive objects.
::
for recursive objects.
>>> pprint.isreadable(stuff)
>>> pprint.isreadable(stuff)
False
False
...
@@ -123,8 +122,8 @@ The :class:`PrettyPrinter` class supports several derivative functions:
...
@@ -123,8 +122,8 @@ The :class:`PrettyPrinter` class supports several derivative functions:
Determine if *object* requires a recursive representation.
Determine if *object* requires a recursive representation.
One more support function is also defined:
One more support function is also defined:
.. function:: saferepr(object)
.. function:: saferepr(object)
...
@@ -133,12 +132,8 @@ One more support function is also defined:
...
@@ -133,12 +132,8 @@ One more support function is also defined:
recursive reference will be represented as ``<Recursion on typename with
recursive reference will be represented as ``<Recursion on typename with
id=number>``. The representation is not otherwise formatted.
id=number>``. The representation is not otherwise formatted.
::
>>> pprint.saferepr(stuff)
>>> pprint.saferepr(stuff)
"[<Recursion on list with id=682968>, '', '/usr/local/lib/python1.5', '/usr/loca
"[<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']"
l/lib/python1.5/test', '/usr/local/lib/python1.5/sunos5', '/usr/local/lib/python
1.5/sharedmodules', '/usr/local/lib/python1.5/tkinter']"
.. _prettyprinter-objects:
.. _prettyprinter-objects:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment