Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b9eccbf

Browse files
committed
Merged revisions 59333-59370 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines Fix typo. ........ r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line Fixed quoting and paths in the sqlite project file ........ r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line Fixed error in regrtest. I must have missed the spot. ........ r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError ........ r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line Added msg to Misc/NEWS ........ r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line Spelling fix ........ r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines Add examples to csv, pprint and traceback docs. Written by Ross for GHOP. ........ r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line Error checking was too aggressive (reported by Chris Tismer) ........ r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines Add examples to re docs. Written for GHOP by Dan Finnie. ........ r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines Fix markup. ........ r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line Updated documentation and build_tkinter.py script ........ r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines Another markup fix. ........ r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard by purging bindings to OSA's debug API's. Those APIs we're completely unsupported on OSX 10.4 and are no longer available on OSX 10.5. Note that this patches a generated file. This is somewhat acceptable because regenerating the file is non-trivial and wouldn't use system headers anyway. ........ r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line Fixed bug #1557 by using popen.communicate() before popen.wait() ........
1 parent a5ea385 commit b9eccbf

14 files changed

Lines changed: 508 additions & 402 deletions

File tree

Doc/ACKS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ [email protected]), and we'll be glad to correct the problem.
4848
* Carey Evans
4949
* Martijn Faassen
5050
* Carl Feynman
51+
* Dan Finnie
5152
* Hernán Martínez Foffani
5253
* Stefan Franke
5354
* Jim Fulton

Doc/c-api/refcounting.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ objects.
6363

6464

6565
The following functions are for runtime dynamic embedding of Python:
66-
``Py_IncRef(PyObject \*o)``, `Py_DecRef(PyObject \*o)``. They are simply
67-
exported function versions of :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF`,
68-
respectively.
66+
``Py_IncRef(PyObject *o)``, ``Py_DecRef(PyObject *o)``. They are
67+
simply exported function versions of :cfunc:`Py_XINCREF` and
68+
:cfunc:`Py_XDECREF`, respectively.
6969

7070
The following functions or macros are only for use within the interpreter core:
7171
:cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`,

Doc/documenting/fromlatex.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ directories renamed as follows:
183183
* :file:`ext` -> :file:`extending`
184184
* :file:`inst` -> :file:`installing`
185185
* :file:`lib` -> :file:`library`
186-
* :file:`mac` -> merged into :file:`library`, with `mac/using.tex`
187-
moved to `howto/pythonmac.rst`
186+
* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex`
187+
moved to :file:`howto/pythonmac.rst`
188188
* :file:`ref` -> :file:`reference`
189189
* :file:`tut` -> :file:`tutorial`, with the single TeX file split up
190190

Doc/library/csv.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ using the :class:`DictReader` and :class:`DictWriter` classes.
4343

4444
.. seealso::
4545

46-
.. % \seemodule{array}{Arrays of uniformly types numeric values.}
47-
4846
:pep:`305` - CSV File API
4947
The Python Enhancement Proposal which proposed this addition to Python.
5048

@@ -83,6 +81,15 @@ The :mod:`csv` module defines the following functions:
8381
consequence, if newlines embedded within fields are important, the input should
8482
be split into lines in a manner which preserves the newline characters.
8583

84+
A short usage example::
85+
86+
>>> import csv
87+
>>> spamReader = csv.reader(open('eggs.csv'), delimiter=' ', quotechar='|')
88+
>>> for row in spamReader:
89+
... print ', '.join(row)
90+
Spam, Spam, Spam, Spam, Spam, Baked Beans
91+
Spam, Lovely Spam, Wonderful Spam
92+
8693

8794
.. function:: writer(csvfile[, dialect='excel'][, fmtparam])
8895

@@ -103,6 +110,14 @@ The :mod:`csv` module defines the following functions:
103110
CSV files without preprocessing the data returned from a ``cursor.fetch*`` call.
104111
All other non-string data are stringified with :func:`str` before being written.
105112

113+
A short usage example::
114+
115+
>>> import csv
116+
>>> spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',
117+
... quotechar='|', quoting=QUOTE_MINIMAL)
118+
>>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans'])
119+
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
120+
106121

107122
.. function:: register_dialect(name[, dialect][, fmtparam])
108123

Doc/library/pprint.rst

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,23 @@ The :mod:`pprint` module defines one class:
4545
structure cannot be formatted within the constrained width, a best effort will
4646
be made. ::
4747

48-
>>> import pprint, sys
49-
>>> stuff = sys.path[:]
48+
>>> import pprint
49+
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
5050
>>> stuff.insert(0, stuff[:])
5151
>>> pp = pprint.PrettyPrinter(indent=4)
5252
>>> pp.pprint(stuff)
53-
[ [ '',
54-
'/usr/local/lib/python1.5',
55-
'/usr/local/lib/python1.5/test',
56-
'/usr/local/lib/python1.5/sunos5',
57-
'/usr/local/lib/python1.5/sharedmodules',
58-
'/usr/local/lib/python1.5/tkinter'],
59-
'',
60-
'/usr/local/lib/python1.5',
61-
'/usr/local/lib/python1.5/test',
62-
'/usr/local/lib/python1.5/sunos5',
63-
'/usr/local/lib/python1.5/sharedmodules',
64-
'/usr/local/lib/python1.5/tkinter']
65-
>>>
66-
>>> import parser
67-
>>> tup = parser.ast2tuple(
68-
... parser.suite(open('pprint.py').read()))[1][1][1]
53+
[ ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
54+
'spam',
55+
'eggs',
56+
'lumberjack',
57+
'knights',
58+
'ni']
59+
>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
60+
... ('parrot', ('fresh fruit',))))))))
6961
>>> pp = pprint.PrettyPrinter(depth=6)
7062
>>> pp.pprint(tup)
71-
(266, (267, (307, (287, (288, (...))))))
63+
('spam',
64+
('eggs', ('lumberjack', ('knights', ('ni', ('dead', ('parrot', (...,))))))))
7265

7366
The :class:`PrettyPrinter` class supports several derivative functions:
7467

@@ -91,7 +84,8 @@ The :class:`PrettyPrinter` class supports several derivative functions:
9184
within a scope). *indent*, *width* and *depth* will be passed to the
9285
:class:`PrettyPrinter` constructor as formatting parameters. ::
9386

94-
>>> stuff = sys.path[:]
87+
>>> import pprint
88+
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
9589
>>> stuff.insert(0, stuff)
9690
>>> pprint.pprint(stuff)
9791
[<Recursion on list with id=869440>,
@@ -200,3 +194,40 @@ are converted to strings. The default implementation uses the internals of the
200194
is no requested limit. This argument should be passed unmodified to recursive
201195
calls. The fourth argument, *level*, gives the current level; recursive calls
202196
should be passed a value less than that of the current call.
197+
198+
199+
.. _pprint-example:
200+
201+
pprint Example
202+
--------------
203+
204+
This example demonstrates several uses of the :func:`pprint` function and its parameters.
205+
206+
>>> import pprint
207+
>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
208+
... ('parrot', ('fresh fruit',))))))))
209+
>>> stuff = ['a' * 10, tup, ['a' * 30, 'b' * 30], ['c' * 20, 'd' * 20]]
210+
>>> pprint.pprint(stuff)
211+
['aaaaaaaaaa',
212+
('spam',
213+
('eggs',
214+
('lumberjack',
215+
('knights', ('ni', ('dead', ('parrot', ('fresh fruit',)))))))),
216+
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
217+
['cccccccccccccccccccc', 'dddddddddddddddddddd']]
218+
>>> pprint.pprint(stuff, depth=3)
219+
['aaaaaaaaaa',
220+
('spam', ('eggs', ('lumberjack', (...)))),
221+
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
222+
['cccccccccccccccccccc', 'dddddddddddddddddddd']]
223+
>>> pprint.pprint(stuff, width=60)
224+
['aaaaaaaaaa',
225+
('spam',
226+
('eggs',
227+
('lumberjack',
228+
('knights',
229+
('ni', ('dead', ('parrot', ('fresh fruit',)))))))),
230+
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
231+
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
232+
['cccccccccccccccccccc', 'dddddddddddddddddddd']]
233+

0 commit comments

Comments
 (0)