Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/abc.rst

    r2 r391  
    1010.. versionadded:: 2.6
    1111
    12 This module provides the infrastructure for defining an :term:`abstract base
    13 class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
     12**Source code:** :source:`Lib/abc.py`
     13
     14--------------
     15
     16This module provides the infrastructure for defining :term:`abstract base
     17classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
    1418was added to Python. (See also :pep:`3141` and the :mod:`numbers` module
    1519regarding a type hierarchy for numbers based on ABCs.)
     
    107111
    108112   The ABC ``MyIterable`` defines the standard iterable method,
    109    :meth:`__iter__`, as an abstract method.  The implementation given here can
    110    still be called from subclasses.  The :meth:`get_iterator` method is also
    111    part of the ``MyIterable`` abstract base class, but it does not have to be
    112    overridden in non-abstract derived classes.
     113   :meth:`~iterator.__iter__`, as an abstract method.  The implementation given
     114   here can still be called from subclasses.  The :meth:`get_iterator` method
     115   is also part of the ``MyIterable`` abstract base class, but it does not have
     116   to be overridden in non-abstract derived classes.
    113117
    114118   The :meth:`__subclasshook__` class method defined here says that any class
    115    that has an :meth:`__iter__` method in its :attr:`__dict__` (or in that of
    116    one of its base classes, accessed via the :attr:`__mro__` list) is
    117    considered a ``MyIterable`` too.
     119   that has an :meth:`~iterator.__iter__` method in its
     120   :attr:`~object.__dict__` (or in that of one of its base classes, accessed
     121   via the :attr:`~class.__mro__` list) is considered a ``MyIterable`` too.
    118122
    119123   Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
    120    even though it does not define an :meth:`__iter__` method (it uses the
    121    old-style iterable protocol, defined in terms of :meth:`__len__` and
     124   even though it does not define an :meth:`~iterator.__iter__` method (it uses
     125   the old-style iterable protocol, defined in terms of :meth:`__len__` and
    122126   :meth:`__getitem__`).  Note that this will not make ``get_iterator``
    123127   available as a method of ``Foo``, so it is provided separately.
Note: See TracChangeset for help on using the changeset viewer.