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

Skip to content

Commit 545c7a9

Browse files
Merge branch 'master' into disable-wchar-cache
2 parents 431e71f + 8abd7c7 commit 545c7a9

210 files changed

Lines changed: 3743 additions & 2208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/faq/general.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,10 @@ guaranteed that interfaces will remain the same throughout a series of bugfix
306306
releases.
307307

308308
The latest stable releases can always be found on the `Python download page
309-
<https://www.python.org/downloads/>`_. There are two production-ready version
310-
of Python: 2.x and 3.x, but the recommended one at this times is Python 3.x.
311-
Although Python 2.x is still widely used, `it will not be
312-
maintained after January 1, 2020 <https://www.python.org/dev/peps/pep-0373/>`_.
313-
Python 2.x was known for having more third-party libraries available, however,
314-
by the time of this writing, most of the widely used libraries support Python 3.x,
315-
and some are even dropping the Python 2.x support.
316-
309+
<https://www.python.org/downloads/>`_. There are two production-ready versions
310+
of Python: 2.x and 3.x. The recommended version is 3.x, which is supported by
311+
most widely used libraries. Although 2.x is still widely used, `it will not
312+
be maintained after January 1, 2020 <https://www.python.org/dev/peps/pep-0373/>`_.
317313

318314
How many people are using Python?
319315
---------------------------------

Doc/faq/windows.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Python on Windows FAQ
1515
.. XXX need review for Python 3.
1616
XXX need review for Windows Vista/Seven?
1717
18+
.. _faq-run-program-under-windows:
19+
1820

1921
How do I run a Python program under Windows?
2022
--------------------------------------------

Doc/glossary.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,11 @@ Glossary
663663
:term:`finder`. See :pep:`302` for details and
664664
:class:`importlib.abc.Loader` for an :term:`abstract base class`.
665665

666+
magic method
667+
.. index:: pair: magic; method
668+
669+
An informal synonym for :term:`special method`.
670+
666671
mapping
667672
A container object that supports arbitrary key lookups and implements the
668673
methods specified in the :class:`~collections.abc.Mapping` or
@@ -1004,6 +1009,8 @@ Glossary
10041009
(subscript) notation uses :class:`slice` objects internally.
10051010

10061011
special method
1012+
.. index:: pair: special; method
1013+
10071014
A method that is called implicitly by Python to execute a certain
10081015
operation on a type, such as addition. Such methods have names starting
10091016
and ending with double underscores. Special methods are documented in

Doc/library/functions.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,18 @@ are always available. They are listed here in alphabetical order.
211211
@classmethod
212212
def f(cls, arg1, arg2, ...): ...
213213

214-
The ``@classmethod`` form is a function :term:`decorator` -- see the description
215-
of function definitions in :ref:`function` for details.
214+
The ``@classmethod`` form is a function :term:`decorator` -- see
215+
:ref:`function` for details.
216216

217-
It can be called either on the class (such as ``C.f()``) or on an instance (such
217+
A class method can be called either on the class (such as ``C.f()``) or on an instance (such
218218
as ``C().f()``). The instance is ignored except for its class. If a class
219219
method is called for a derived class, the derived class object is passed as the
220220
implied first argument.
221221

222222
Class methods are different than C++ or Java static methods. If you want those,
223-
see :func:`staticmethod` in this section.
223+
see :func:`staticmethod`.
224224

225-
For more information on class methods, consult the documentation on the standard
226-
type hierarchy in :ref:`types`.
225+
For more information on class methods, see :ref:`types`.
227226

228227

229228
.. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
@@ -1452,11 +1451,11 @@ are always available. They are listed here in alphabetical order.
14521451
@staticmethod
14531452
def f(arg1, arg2, ...): ...
14541453

1455-
The ``@staticmethod`` form is a function :term:`decorator` -- see the
1456-
description of function definitions in :ref:`function` for details.
1454+
The ``@staticmethod`` form is a function :term:`decorator` -- see
1455+
:ref:`function` for details.
14571456

1458-
It can be called either on the class (such as ``C.f()``) or on an instance (such
1459-
as ``C().f()``). The instance is ignored except for its class.
1457+
A static method can be called either on the class (such as ``C.f()``) or on an instance (such
1458+
as ``C().f()``).
14601459

14611460
Static methods in Python are similar to those found in Java or C++. Also see
14621461
:func:`classmethod` for a variant that is useful for creating alternate class
@@ -1471,8 +1470,7 @@ are always available. They are listed here in alphabetical order.
14711470
class C:
14721471
builtin_open = staticmethod(open)
14731472

1474-
For more information on static methods, consult the documentation on the
1475-
standard type hierarchy in :ref:`types`.
1473+
For more information on static methods, see :ref:`types`.
14761474

14771475

14781476
.. index::

Doc/library/functools.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@ The :mod:`functools` module defines the following functions:
474474
The same pattern can be used for other similar decorators: ``staticmethod``,
475475
``abstractmethod``, and others.
476476

477+
.. versionadded:: 3.8
478+
479+
477480
.. function:: update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
478481

479482
Update a *wrapper* function to look like the *wrapped* function. The optional

Doc/library/idle.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ Shell and Output windows also have the following.
356356
Go to file/line
357357
Same as in Debug menu.
358358

359-
The Shell window also has an output squeezing facility explained in the
360-
the *Python Shell window* subsection below.
359+
The Shell window also has an output squeezing facility explained in the *Python
360+
Shell window* subsection below.
361361

362362
Squeeze
363363
If the cursor is over an output line, squeeze all the output between
@@ -716,17 +716,15 @@ In contrast, some system text windows only keep the last n lines of output.
716716
A Windows console, for instance, keeps a user-settable 1 to 9999 lines,
717717
with 300 the default.
718718

719-
A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints)
720-
in the the BMP (Basic Multilingual Plane) subset of Unicode.
721-
Which characters are displayed with a proper glyph and which with a
722-
replacement box depends on the operating system and installed fonts.
723-
Tab characters cause the following text to begin after
724-
the next tab stop. (They occur every 8 'characters').
725-
Newline characters cause following text to appear on a new line.
726-
Other control characters are ignored or displayed as a space, box, or
727-
something else, depending on the operating system and font.
728-
(Moving the text cursor through such output with arrow keys may exhibit
729-
some surprising spacing behavior.)
719+
A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints) in
720+
the BMP (Basic Multilingual Plane) subset of Unicode. Which characters are
721+
displayed with a proper glyph and which with a replacement box depends on the
722+
operating system and installed fonts. Tab characters cause the following text
723+
to begin after the next tab stop. (They occur every 8 'characters'). Newline
724+
characters cause following text to appear on a new line. Other control
725+
characters are ignored or displayed as a space, box, or something else,
726+
depending on the operating system and font. (Moving the text cursor through
727+
such output with arrow keys may exhibit some surprising spacing behavior.)
730728

731729
.. code-block:: none
732730

Doc/library/itertools.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,17 @@ Iterator Arguments Resu
7070
:func:`permutations` p[, r] r-length tuples, all possible orderings, no repeated elements
7171
:func:`combinations` p, r r-length tuples, in sorted order, no repeated elements
7272
:func:`combinations_with_replacement` p, r r-length tuples, in sorted order, with repeated elements
73-
``product('ABCD', repeat=2)`` ``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``
74-
``permutations('ABCD', 2)`` ``AB AC AD BA BC BD CA CB CD DA DB DC``
75-
``combinations('ABCD', 2)`` ``AB AC AD BC BD CD``
76-
``combinations_with_replacement('ABCD', 2)`` ``AA AB AC AD BB BC BD CC CD DD``
7773
============================================== ==================== =============================================================
7874

75+
============================================== =============================================================
76+
Examples Results
77+
============================================== =============================================================
78+
``product('ABCD', repeat=2)`` ``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``
79+
``permutations('ABCD', 2)`` ``AB AC AD BA BC BD CA CB CD DA DB DC``
80+
``combinations('ABCD', 2)`` ``AB AC AD BC BD CD``
81+
``combinations_with_replacement('ABCD', 2)`` ``AA AB AC AD BB BC BD CC CD DD``
82+
============================================== =============================================================
83+
7984

8085
.. _itertools-functions:
8186

Doc/library/logging.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,10 @@ functions.
12151215
closing all handlers. This should be called at application exit and no
12161216
further use of the logging system should be made after this call.
12171217

1218+
When the logging module is imported, it registers this function as an exit
1219+
handler (see :mod:`atexit`), so normally there's no need to do that
1220+
manually.
1221+
12181222

12191223
.. function:: setLoggerClass(klass)
12201224

Doc/library/multiprocessing.shared_memory.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ same ``numpy.ndarray`` from two distinct Python shells:
176176

177177

178178
.. class:: SharedMemoryManager([address[, authkey]])
179+
:module: multiprocessing.managers
179180

180181
A subclass of :class:`~multiprocessing.managers.BaseManager` which can be
181182
used for the management of shared memory blocks across processes.
@@ -218,8 +219,8 @@ The following example demonstrates the basic mechanisms of a
218219
.. doctest::
219220
:options: +SKIP
220221

221-
>>> from multiprocessing import shared_memory
222-
>>> smm = shared_memory.SharedMemoryManager()
222+
>>> from multiprocessing.managers import SharedMemoryManager
223+
>>> smm = SharedMemoryManager()
223224
>>> smm.start() # Start the process that manages the shared memory blocks
224225
>>> sl = smm.ShareableList(range(4))
225226
>>> sl
@@ -238,7 +239,7 @@ needed:
238239
.. doctest::
239240
:options: +SKIP
240241

241-
>>> with shared_memory.SharedMemoryManager() as smm:
242+
>>> with SharedMemoryManager() as smm:
242243
... sl = smm.ShareableList(range(2000))
243244
... # Divide the work among two processes, storing partial results in sl
244245
... p1 = Process(target=do_work, args=(sl, 0, 1000))

Doc/library/pprint.rst

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The :mod:`pprint` module defines one class:
3333
.. index:: single: ...; placeholder
3434

3535
.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, \
36-
compact=False)
36+
compact=False, sort_dicts=True)
3737

3838
Construct a :class:`PrettyPrinter` instance. This constructor understands
3939
several keyword parameters. An output stream may be set using the *stream*
@@ -50,11 +50,17 @@ The :mod:`pprint` module defines one class:
5050
structure cannot be formatted within the constrained width, a best effort will
5151
be made. If *compact* is false (the default) each item of a long sequence
5252
will be formatted on a separate line. If *compact* is true, as many items
53-
as will fit within the *width* will be formatted on each output line.
53+
as will fit within the *width* will be formatted on each output line. If
54+
*sort_dicts* is true (the default), dictionaries will be formatted with their
55+
keys sorted, otherwise they will display in insertion order.
5456

5557
.. versionchanged:: 3.4
5658
Added the *compact* parameter.
5759

60+
.. versionchanged:: 3.8
61+
Added the *sort_dicts* parameter.
62+
63+
5864
>>> import pprint
5965
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
6066
>>> stuff.insert(0, stuff[:])
@@ -81,29 +87,47 @@ The :mod:`pprint` module defines one class:
8187

8288
The :mod:`pprint` module also provides several shortcut functions:
8389

84-
.. function:: pformat(object, indent=1, width=80, depth=None, *, compact=False)
90+
.. function:: pformat(object, indent=1, width=80, depth=None, *, \
91+
compact=False, sort_dicts=True)
8592

8693
Return the formatted representation of *object* as a string. *indent*,
87-
*width*, *depth* and *compact* will be passed to the :class:`PrettyPrinter`
88-
constructor as formatting parameters.
94+
*width*, *depth*, *compact* and *sort_dicts* will be passed to the
95+
:class:`PrettyPrinter` constructor as formatting parameters.
8996

9097
.. versionchanged:: 3.4
9198
Added the *compact* parameter.
9299

100+
.. versionchanged:: 3.8
101+
Added the *sort_dicts* parameter.
102+
103+
104+
.. function:: pp(object, *args, sort_dicts=False, **kwargs)
105+
106+
Prints the formatted representation of *object* followed by a newline.
107+
If *sort_dicts* is false (the default), dictionaries will be displayed with
108+
their keys in insertion order, otherwise the dict keys will be sorted.
109+
*args* and *kwargs* will be passed to :func:`pprint` as formatting
110+
parameters.
111+
112+
.. versionadded:: 3.8
113+
93114

94115
.. function:: pprint(object, stream=None, indent=1, width=80, depth=None, *, \
95-
compact=False)
116+
compact=False, sort_dicts=True)
96117

97118
Prints the formatted representation of *object* on *stream*, followed by a
98119
newline. If *stream* is ``None``, ``sys.stdout`` is used. This may be used
99120
in the interactive interpreter instead of the :func:`print` function for
100121
inspecting values (you can even reassign ``print = pprint.pprint`` for use
101-
within a scope). *indent*, *width*, *depth* and *compact* will be passed
102-
to the :class:`PrettyPrinter` constructor as formatting parameters.
122+
within a scope). *indent*, *width*, *depth*, *compact* and *sort_dicts* will
123+
be passed to the :class:`PrettyPrinter` constructor as formatting parameters.
103124

104125
.. versionchanged:: 3.4
105126
Added the *compact* parameter.
106127

128+
.. versionchanged:: 3.8
129+
Added the *sort_dicts* parameter.
130+
107131
>>> import pprint
108132
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
109133
>>> stuff.insert(0, stuff)

0 commit comments

Comments
 (0)