Kaydet (Commit) 459b452b authored tarafından Éric Araujo's avatar Éric Araujo

Merge ABC and distutils touch-ups from 3.2.

I have removed the reST target I added in 38cdca2cc253: it is not necessary, as
people can link to the glossary entry or the abc module without it.

Two indentation fixes from 3.2 collections.rst have been ported to 3.3
collections.abc.rst.
...@@ -27,12 +27,14 @@ Glossary ...@@ -27,12 +27,14 @@ Glossary
:ref:`2to3-reference`. :ref:`2to3-reference`.
abstract base class abstract base class
:ref:`abstract-base-classes` complement :term:`duck-typing` by Abstract base classes complement :term:`duck-typing` by
providing a way to define interfaces when other techniques like providing a way to define interfaces when other techniques like
:func:`hasattr` would be clumsy. Python comes with many built-in ABCs for :func:`hasattr` would be clumsy or subtly wrong (for example with
data structures (in the :mod:`collections` module), numbers (in the :ref:`magic methods <special-lookup>`). Python comes with many built-in ABCs for
:mod:`numbers` module), and streams (in the :mod:`io` module). You can data structures (in the :mod:`collections.abc` module), numbers (in the
create your own ABC with the :mod:`abc` module. :mod:`numbers` module), streams (in the :mod:`io` module), import finders
and loaders (in the :mod:`importlib.abc` module). You can create your own
ABCs with the :mod:`abc` module.
argument argument
A value passed to a function or method, assigned to a named local A value passed to a function or method, assigned to a named local
...@@ -430,8 +432,8 @@ Glossary ...@@ -430,8 +432,8 @@ Glossary
mapping mapping
A container object that supports arbitrary key lookups and implements the A container object that supports arbitrary key lookups and implements the
methods specified in the :class:`Mapping` or :class:`MutableMapping` methods specified in the :class:`Mapping` or :class:`MutableMapping`
:ref:`abstract base classes <abstract-base-classes>`. Examples include :ref:`abstract base classes <collections-abstract-base-classes>`. Examples
:class:`dict`, :class:`collections.defaultdict`, include :class:`dict`, :class:`collections.defaultdict`,
:class:`collections.OrderedDict` and :class:`collections.Counter`. :class:`collections.OrderedDict` and :class:`collections.Counter`.
metaclass metaclass
......
.. _abstract-base-classes:
:mod:`abc` --- Abstract Base Classes :mod:`abc` --- Abstract Base Classes
==================================== ====================================
......
...@@ -44,7 +44,7 @@ ABC Inherits from Abstract Methods Mixin ...@@ -44,7 +44,7 @@ ABC Inherits from Abstract Methods Mixin
:class:`Iterable`, ``index``, and ``count`` :class:`Iterable`, ``index``, and ``count``
:class:`Container` :class:`Container`
:class:`MutableSequence` :class:`Sequence` ``__setitem__`` Inherited :class:`Sequence` methods and :class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and
``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``,
``insert`` ``remove``, ``clear``, and ``__iadd__`` ``insert`` ``remove``, ``clear``, and ``__iadd__``
...@@ -175,7 +175,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin: ...@@ -175,7 +175,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
.. seealso:: .. seealso::
* `OrderedSet recipe <http://code.activestate.com/recipes/576694/>`_ that uses * `OrderedSet recipe <http://code.activestate.com/recipes/576694/>`_ for an
:class:`MutableSet`. example built on :class:`MutableSet`.
* For more about ABCs, see the :mod:`abc` module and :pep:`3119`. * For more about ABCs, see the :mod:`abc` module and :pep:`3119`.
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
:synopsis: Numeric abstract base classes (Complex, Real, Integral, etc.). :synopsis: Numeric abstract base classes (Complex, Real, Integral, etc.).
The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric abstract The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric
base classes which progressively define more operations. None of the types :term:`abstract base classes <abstract base class>` which progressively define
defined in this module can be instantiated. more operations. None of the types defined in this module can be instantiated.
.. class:: Number .. class:: Number
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment