filesystem and building lists of files.
-:mod:`distutils.log` --- Simple PEP 282-style logging
-=====================================================
+:mod:`distutils.log` --- Simple :pep:`282`-style logging
+========================================================
.. module:: distutils.log
- :synopsis: A simple logging mechanism, 282-style
+ :synopsis: A simple logging mechanism, :pep:`282`-style
:mod:`distutils.spawn` --- Spawn a sub-process
``annotation``
The annotation value for this parameter. Not currently supported,
- because PEP 8 mandates that the Python library may not use
+ because :pep:`8` mandates that the Python library may not use
annotations.
In addition, some converters accept additional arguments. Here is a list
====================================
.. module:: abc
- :synopsis: Abstract base classes according to PEP 3119.
+ :synopsis: Abstract base classes according to :pep:`3119`.
.. moduleauthor:: Guido van Rossum
.. sectionauthor:: Georg Brandl
.. deprecated:: 3.3
This emulation is no longer needed, as the standard import mechanism
- is now fully PEP 302 compliant and available in :mod:`importlib`.
+ is now fully :pep:`302` compliant and available in :mod:`importlib`.
.. class:: ImpLoader(fullname, file, filename, etc)
.. deprecated:: 3.3
This emulation is no longer needed, as the standard import mechanism
- is now fully PEP 302 compliant and available in :mod:`importlib`.
+ is now fully :pep:`302` compliant and available in :mod:`importlib`.
.. function:: find_loader(fullname)
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. versionchanged:: 3.4
Updated to be based on :pep:`451`
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. function:: get_loader(module_or_name)
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. versionchanged:: 3.4
Updated to be based on :pep:`451`
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. function:: iter_modules(path=None, prefix='')
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. function:: walk_packages(path=None, prefix='', onerror=None)
.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
- on the package internal PEP 302 import emulation.
+ on the package internal :pep:`302` import emulation.
.. function:: get_data(package, resource)
.. function:: make_legacy_pyc(source)
- Move a PEP 3147/488 pyc file to its legacy pyc location and return the file
+ Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return the file
system path to the legacy pyc file. The *source* value is the file system
path to the source file. It does not need to exist, however the PEP
3147/488 pyc file must exist.
========================================
.. module:: typing
- :synopsis: Support for type hints (see PEP 484).
+ :synopsis: Support for type hints (see :pep:`484`).
.. versionadded:: 3.5
.. function:: read_environ()
- Transcode CGI variables from ``os.environ`` to PEP 3333 "bytes in unicode"
+ Transcode CGI variables from ``os.environ`` to :pep:`3333` "bytes in unicode"
strings, returning a new dictionary. This function is used by
:class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using
``os.environ``, which is not necessarily WSGI-compliant on all platforms
:pep:`273` - Import Modules from Zip Archives
Written by James C. Ahlstrom, who also provided an implementation. Python 2.3
- follows the specification in PEP 273, but uses an implementation written by Just
- van Rossum that uses the import hooks described in PEP 302.
+ follows the specification in :pep:`273`, but uses an implementation written by Just
+ van Rossum that uses the import hooks described in :pep:`302`.
:pep:`302` - New Import Hooks
The PEP to add the import hooks that help this module work.
Python Enhancement Proposals (PEPs), modelled on the Internet RFC process. PEPs
are draft documents that describe a proposed new feature, and are continually
revised until the community reaches a consensus, either accepting or rejecting
-the proposal. Quoting from the introduction to PEP 1, "PEP Purpose and
+the proposal. Quoting from the introduction to :pep:`1`, "PEP Purpose and
Guidelines":
that have gone into Python. The PEP author is responsible for building
consensus within the community and documenting dissenting opinions.
-Read the rest of PEP 1 for the details of the PEP editorial process, style, and
+Read the rest of :pep:`1` for the details of the PEP editorial process, style, and
format. PEPs are kept in the Python CVS tree on SourceForge, though they're not
part of the Python 2.0 distribution, and are also available in HTML form from
https://www.python.org/dev/peps/. As of September 2000, there are 25 PEPS, ranging
-from PEP 201, "Lockstep Iteration", to PEP 225, "Elementwise/Objectwise
+from :pep:`201`, "Lockstep Iteration", to PEP 225, "Elementwise/Objectwise
Operators".
.. ======================================================================
Compatibility concerns have led to nested scopes being introduced gradually; in
Python 2.1, they aren't enabled by default, but can be turned on within a module
-by using a future statement as described in PEP 236. (See the following section
-for further discussion of PEP 236.) In Python 2.2, nested scopes will become
+by using a future statement as described in :pep:`236`. (See the following section
+for further discussion of :pep:`236`.) In Python 2.2, nested scopes will become
the default and there will be no way to turn them off, but users will have had
all of 2.1's lifetime to fix any breakage resulting from their introduction.
There are also corresponding changes of interest to C programmers; there's a new
slot ``tp_richcmp`` in type objects and an API for performing a given rich
-comparison. I won't cover the C API here, but will refer you to PEP 207, or to
+comparison. I won't cover the C API here, but will refer you to :pep:`207`, or to
2.1's C API documentation, for the full list of related functions.
As a first small step toward fixing the problem, Python software packaged using
the Distutils :command:`sdist` command will include a file named
:file:`PKG-INFO` containing information about the package such as its name,
-version, and author (metadata, in cataloguing terminology). PEP 241 contains
+version, and author (metadata, in cataloguing terminology). :pep:`241` contains
the full list of fields that can be present in the :file:`PKG-INFO` file. As
people began to package their software using Python 2.1, more and more packages
will include metadata, making it possible to build automated cataloguing systems
You can start creating packages containing :file:`PKG-INFO` even if you're not
using Python 2.1, since a new release of the Distutils will be made for users of
earlier Python versions. Version 1.0.2 of the Distutils includes the changes
-described in PEP 241, as well as various bugfixes and enhancements. It will be
+described in :pep:`241`, as well as various bugfixes and enhancements. It will be
available from the Distutils SIG at https://www.python.org/community/sigs/current/distutils-sig/.
PEP 328: Absolute and Relative Imports
======================================
-The simpler part of PEP 328 was implemented in Python 2.4: parentheses could now
+The simpler part of :pep:`328` was implemented in Python 2.4: parentheses could now
be used to enclose the names imported from a module using the ``from ... import
...`` statement, making it easier to import many different names.
statements with a ``try...finally`` suite has therefore been removed. This
seems like a minor bit of language trivia, but using generators and
``try...finally`` is actually necessary in order to implement the
-:keyword:`with` statement described by PEP 343. I'll look at this new statement
+:keyword:`with` statement described by :pep:`343`. I'll look at this new statement
in the following section.
Another even more esoteric effect of this change: previously, the
2.4, so this completes the removal of the feature.
* The :mod:`pkgutil` module, containing various utility functions for finding
- packages, was enhanced to support PEP 302's import hooks and now also works for
+ packages, was enhanced to support :pep:`302`'s import hooks and now also works for
packages stored in ZIP-format archives. (Contributed by Phillip J. Eby.)
* The pybench benchmark suite by Marc-André Lemburg is now included in the
The :mod:`wsgiref` package is a reference implementation of the WSGI
specification.
-.. XXX should this be in a PEP 333 section instead?
+.. XXX should this be in a :pep:`333` section instead?
The package includes a basic HTTP server that will run a WSGI application; this
server is useful for debugging but isn't intended for production use. Setting
On the Python side, there should be no downside to this change.
-On the C API side, PEP 393 is fully backward compatible. The legacy API
+On the C API side, :pep:`393` is fully backward compatible. The legacy API
should remain available at least five years. Applications using the legacy
API will not fully benefit of the memory reduction, or - worse - may use
a bit more memory, because Python may have to maintain two versions of each
The new functions :func:`types.new_class` and :func:`types.prepare_class` provide support
-for PEP 3115 compliant dynamic type creation. (:issue:`14588`)
+for :pep:`3115` compliant dynamic type creation. (:issue:`14588`)
unittest
case of working with :term:`path entry finders <path entry finder>`.
* :mod:`pkgutil` has been converted to use :mod:`importlib` internally. This
- eliminates many edge cases where the old behaviour of the PEP 302 import
+ eliminates many edge cases where the old behaviour of the :pep:`302` import
emulation failed to match the behaviour of the real import system. The
import emulation itself is still present, but is now deprecated. The
:func:`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` functions
functions using this type are deprecated (but will stay available for
at least five years). If you were using low-level Unicode APIs to
construct and access unicode objects and you want to benefit of the
- memory footprint reduction provided by PEP 393, you have to convert
+ memory footprint reduction provided by :pep:`393`, you have to convert
your code to the new :doc:`Unicode API <../c-api/unicode>`.
However, if you only have been using high-level functions such as
.. nonce: kfV0wm
.. section: Library
-Fix PEP 3118 format strings on ctypes objects with a nontrivial shape.
+Fix :pep:`3118` format strings on ctypes objects with a nontrivial shape.
..
.. nonce: kqetng
.. section: IDLE
-Change default paragraph width to 72, the PEP 8 recommendation.
+Change default paragraph width to 72, the :pep:`8` recommendation.
..
.. nonce: dpFbyZ
.. section: Tools/Demos
-Add support for the PEP 465 matrix multiplication operator to 2to3.
+Add support for the :pep:`465` matrix multiplication operator to 2to3.
..
.. nonce: Ks6_2x
.. section: Library
-New os.scandir() function, part of the PEP 471: "os.scandir() function -- a
+New os.scandir() function, part of the :pep:`471`: "os.scandir() function -- a
better and faster directory iterator". Patch written by Ben Hoyt.
..
.. nonce: qBauCy
.. section: Windows
-Implement PEP 486 - Make the Python Launcher aware of virtual environments.
+Implement :pep:`486` - Make the Python Launcher aware of virtual environments.
Patch by Paul Moore.
..
Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include the
architecture triplet in the extension name, to make it easy to test builds
for different ABIs in the same working tree. Under OS X, the extension name
-now includes PEP 3149-style information.
+now includes :pep:`3149`-style information.
..
.. nonce: FOXb37
.. section: Core and Builtins
-Implement PEP 488: removal of .pyo files.
+Implement :pep:`488`: removal of .pyo files.
..
select.select() is now retried automatically with the recomputed timeout
when interrupted by a signal, except if the signal handler raises an
-exception. This change is part of the PEP 475.
+exception. This change is part of the :pep:`475`.
..
.. nonce: M2rJNs
.. section: Library
-Add math.isclose() and cmath.isclose() functions as per PEP 485. Contributed
+Add math.isclose() and cmath.isclose() functions as per :pep:`485`. Contributed
by Chris Barker and Tal Einat.
..
.. nonce: 2mNeD8
.. section: Core and Builtins
-Introduce a distinct type for PEP 492 coroutines; add types.CoroutineType,
+Introduce a distinct type for :pep:`492` coroutines; add types.CoroutineType,
inspect.getcoroutinestate, inspect.getcoroutinelocals; coroutines no longer
use CO_GENERATOR flag; sys.set_coroutine_wrapper works only for 'async def'
coroutines; inspect.iscoroutine no longer uses collections.abc.Coroutine,
.. nonce: bqh6PQ
.. section: Core and Builtins
-Make PEP 448 dictionary evaluation more consistent.
+Make :pep:`448` dictionary evaluation more consistent.
..
.. nonce: 2gLdfN
.. section: Core and Builtins
-Fix AST compilation for PEP 448 syntax.
+Fix AST compilation for :pep:`448` syntax.
..
.. nonce: tCCgmH
.. section: Core and Builtins
-Mention PEP 420 in the importlib docs.
+Mention :pep:`420` in the importlib docs.
..
@overload outside stubs, Reversible, DefaultDict, Text, ContextManager,
Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of
the new features are not yet implemented in mypy or other static analyzers).
-Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been
+Also classes for :pep:`492` (Awaitable, AsyncIterable, AsyncIterator) have been
added (in fact they made it into 3.5.1 but were never mentioned).
..
.. nonce: MUK0zK
.. section: Documentation
-Document the new PEP 448 unpacking syntax of 3.5.
+Document the new :pep:`448` unpacking syntax of 3.5.
..
When an exception is raised within the context being managed by a
contextlib.ExitStack() and one of the exit stack generators catches and
raises it in a chain, do not re-raise the original exception when exiting,
-let the new chained one through. This avoids the PEP 479 bug described in
+let the new chained one through. This avoids the :pep:`479` bug described in
issue25782.
..
.. nonce: tCCgmH
.. section: Core and Builtins
-Mention PEP 420 in the importlib docs.
+Mention :pep:`420` in the importlib docs.
..
.. nonce: CuMWZJ
.. section: Core and Builtins
-Switch applicable importlib tests to use PEP 451 API.
+Switch applicable importlib tests to use :pep:`451` API.
..
.. nonce: wfyxbB
.. section: Core and Builtins
-Implement PEP 498 "Literal String Interpolation". This allows you to embed
+Implement :pep:`498` "Literal String Interpolation". This allows you to embed
expressions inside f-strings, which are converted to normal strings at run
time. Given x=3, then f'value={x}' == 'value=3'. Patch by Eric V. Smith.
.. nonce: LR__VD
.. section: Library
-Add secrets module as described in PEP 506.
+Add secrets module as described in :pep:`506`.
..
.. nonce: EAnCS7
.. section: Core and Builtins
-Add support for os.PathLike objects to open() (part of PEP 519).
+Add support for os.PathLike objects to open() (part of :pep:`519`).
..
.. nonce: UYiwoh
.. section: Library
-Add os.PathLike support to DirEntry (part of PEP 519). Initial patch by
+Add os.PathLike support to DirEntry (part of :pep:`519`). Initial patch by
Jelle Zijlstra.
..
.. section: Library
Add support for os.PathLike objects to os.fsencode() and os.fsdecode() (part
-of PEP 519).
+of :pep:`519`).
..
.. nonce: y7YRfj
.. section: Library
-Introduce os.PathLike and os.fspath() (part of PEP 519).
+Introduce os.PathLike and os.fspath() (part of :pep:`519`).
..
@overload outside stubs, Reversible, DefaultDict, Text, ContextManager,
Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of
the new features are not yet implemented in mypy or other static analyzers).
-Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been
+Also classes for :pep:`492` (Awaitable, AsyncIterable, AsyncIterator) have been
added (in fact they made it into 3.5.1 but were never mentioned).
..
.. nonce: MUK0zK
.. section: Documentation
-Document the new PEP 448 unpacking syntax of 3.5.
+Document the new :pep:`448` unpacking syntax of 3.5.
..
.. nonce: Ll8R-t
.. section: C API
-Add the PyOS_FSPath() function (part of PEP 519).
+Add the PyOS_FSPath() function (part of :pep:`519`).
..
When an exception is raised within the context being managed by a
contextlib.ExitStack() and one of the exit stack generators catches and
raises it in a chain, do not re-raise the original exception when exiting,
-let the new chained one through. This avoids the PEP 479 bug described in
+let the new chained one through. This avoids the :pep:`479` bug described in
issue25782.
..
.. nonce: VrInsj
.. section: Core and Builtins
-Implemented PEP 487 (Simpler customization of class creation). Upon
+Implemented :pep:`487` (Simpler customization of class creation). Upon
subclassing, the __init_subclass__ classmethod is called on the base class.
Descriptors are initialized with __set_name__ after class creation.
.. nonce: nfVMKM
.. section: Library
-Add PEP 519/__fspath__() support to the os and os.path modules. Includes
+Add :pep:`519`/__fspath__() support to the os and os.path modules. Includes
code from Jelle Zijlstra. (See also: bpo-27524)
..
.. nonce: nbAEM8
.. section: Library
-Add mathematical constant tau to math and cmath. See also PEP 628.
+Add mathematical constant tau to math and cmath. See also :pep:`628`.
..
.. nonce: IDW05R
.. section: Library
-Implemented PEP 495 (Local Time Disambiguation).
+Implemented :pep:`495` (Local Time Disambiguation).
..
.. nonce: O0o0mB
.. section: Windows
-Adds PEP 514 metadata to Windows installer
+Adds :pep:`514` metadata to Windows installer
..
.. nonce: Te4Tjb
.. section: Core and Builtins
-Implement formatting support for PEP 515. Initial patch by Chris Angelico.
+Implement formatting support for :pep:`515`. Initial patch by Chris Angelico.
..
.. nonce: TdJp8_
.. section: Core and Builtins
-Implement tokenizing support for PEP 515. Patch by Georg Brandl.
+Implement tokenizing support for :pep:`515`. Patch by Georg Brandl.
..
.. nonce: noeoav
.. section: Core and Builtins
-Implement PEP 525 -- Asynchronous Generators.
+Implement :pep:`525` -- Asynchronous Generators.
..
.. nonce: 0ayJ5k
.. section: Core and Builtins
-Implement PEP 526 -- Syntax for Variable Annotations. Patch by Ivan
+Implement :pep:`526` -- Syntax for Variable Annotations. Patch by Ivan
Levkivskyi.
..
.. nonce: rdhhVw
.. section: Core and Builtins
-Implement PEP 523.
+Implement :pep:`523`.
..
.. nonce: 0DdIrA
.. section: Core and Builtins
-Implement PEP 530 -- asynchronous comprehensions.
+Implement :pep:`530` -- asynchronous comprehensions.
..
The data model reference and the porting section in the What's New guide now
cover the additional ``__classcell__`` handling needed for custom
-metaclasses to fully support PEP 487 and zero-argument ``super()``.
+metaclasses to fully support :pep:`487` and zero-argument ``super()``.
..
.. nonce: kN5S6v
.. section: Library
-functools.lru_cache() now respects PEP 468 and preserves the order of
+functools.lru_cache() now respects :pep:`468` and preserves the order of
keyword arguments. f(a=1, b=2) is now cached separately from f(b=2, a=1)
since both calls could potentially give different results.
.. nonce: bhvrJ2
.. section: Windows
-Implement PEP 529 for io.FileIO (Patch by Eryk Sun)
+Implement :pep:`529` for io.FileIO (Patch by Eryk Sun)
..
.. nonce: nmAvfu
.. section: Library
-Fix ctypes producing wrong PEP 3118 type codes for integer types.
+Fix ctypes producing wrong :pep:`3118` type codes for integer types.
..
.. section: Tools/Demos
gdb integration commands (py-bt, etc.) work on optimized shared builds now,
-too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines
+too. :pep:`523` introduced _PyEval_EvalFrameDefault which inlines
PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to
use py-bt, py-up, and a few other Python-specific gdb integrations. The
problem is fixed by only looking for _PyEval_EvalFrameDefault frames in
.. nonce: pyR0jB
.. section: Library
-Update difflib.mdiff() for PEP 479. Convert an uncaught StopIteration in a
+Update difflib.mdiff() for :pep:`479`. Convert an uncaught StopIteration in a
generator into a return-statement.
..
.. nonce: f_IHor
.. section: Core and Builtins
-Implement PEP 538 (legacy C locale coercion). This means that when a
+Implement :pep:`538` (legacy C locale coercion). This means that when a
suitable coercion target locale is available, both the core interpreter and
locale-aware C extensions will assume the use of UTF-8 as the default text
encoding, rather than ASCII.
.. nonce: 2a8zxB
.. section: Core and Builtins
-Clean up interpreter startup (see PEP 432).
+Clean up interpreter startup (see :pep:`432`).
..
.. nonce: nmAvfu
.. section: Library
-Fix ctypes producing wrong PEP 3118 type codes for integer types.
+Fix ctypes producing wrong :pep:`3118` type codes for integer types.
..
The data model reference and the porting section in the 3.6 What's New guide
now cover the additional ``__classcell__`` handling needed for custom
-metaclasses to fully support PEP 487 and zero-argument ``super()``.
+metaclasses to fully support :pep:`487` and zero-argument ``super()``.
..
.. nonce: XLuZFk
.. section: Build
-Per PEP 11, support for the IRIX operating system was removed.
+Per :pep:`11`, support for the IRIX operating system was removed.
..
.. section: Tools/Demos
gdb integration commands (py-bt, etc.) work on optimized shared builds now,
-too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines
+too. :pep:`523` introduced _PyEval_EvalFrameDefault which inlines
PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to
use py-bt, py-up, and a few other Python-specific gdb integrations. The
problem is fixed by only looking for _PyEval_EvalFrameDefault frames in
.. nonce: _kr47t
.. section: Core and Builtins
-Make ``async`` and ``await`` proper keywords, as specified in PEP 492.
+Make ``async`` and ``await`` proper keywords, as specified in :pep:`492`.
..
.. nonce: vm8vGE
.. section: C API
-Implement PEP 539 for Thread Specific Storage (TSS) API: it is a new Thread
+Implement :pep:`539` for Thread Specific Storage (TSS) API: it is a new Thread
Local Storage (TLS) API to CPython which would supersede use of the existing
TLS API within the CPython interpreter, while deprecating the existing API.
PEP written by Erik M. Bray, patch by Masayuki Yamamoto.
.. nonce: YMQ7Q2
.. section: Library
-inspect.signature should follow PEP 8, if the parameter has an annotation
+inspect.signature should follow :pep:`8`, if the parameter has an annotation
and a default value. Patch by Dong-hee Na.
..
.. nonce: pyR0jB
.. section: Library
-Update difflib.mdiff() for PEP 479. Convert an uncaught StopIteration in a
+Update difflib.mdiff() for :pep:`479`. Convert an uncaught StopIteration in a
generator into a return-statement.
..
.. nonce: S1LGPa
.. section: Documentation
-Document PEP 567 changes to asyncio.
+Document :pep:`567` changes to asyncio.
..
.. nonce: r4z9MM
.. section: Documentation
-Clarified the relationship between PEP 538's PYTHONCOERCECLOCALE and PEP
+Clarified the relationship between :pep:`538`'s PYTHONCOERCECLOCALE and PEP
540's PYTHONUTF8 mode.
..
-Document PEP 567 changes to asyncio.
+Document :pep:`567` changes to asyncio.
-Clarified the relationship between PEP 538's PYTHONCOERCECLOCALE and PEP
+Clarified the relationship between :pep:`538`'s PYTHONCOERCECLOCALE and PEP
540's PYTHONUTF8 mode.
--- /dev/null
+Replace PEP XYZ by the pep role and allow to use the direct links to the PEPs.
-Update difflib.mdiff() for PEP 479. Convert an uncaught StopIteration in a
+Update difflib.mdiff() for :pep:`479`. Convert an uncaught StopIteration in a
generator into a return-statement.