diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-07 01:10:25 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-07 01:10:25 (GMT) |
commit | 05179d528ca2252742bbaca447da57b926ec0bb6 (patch) | |
tree | 6e1516c031db06e0fb9e2a2fa84529de9dece3a5 /Doc/howto | |
parent | 3d1f2d3b52084bf967092ed77309cba1aed206f3 (diff) | |
download | cpython-05179d528ca2252742bbaca447da57b926ec0bb6.zip cpython-05179d528ca2252742bbaca447da57b926ec0bb6.tar.gz cpython-05179d528ca2252742bbaca447da57b926ec0bb6.tar.bz2 |
use source role instead of linking to svn
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/descriptor.rst | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index 2a323c7..d644512 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -96,9 +96,9 @@ For objects, the machinery is in :meth:`object.__getattribute__` which transforms ``b.x`` into ``type(b).__dict__['x'].__get__(b, type(b))``. The implementation works through a precedence chain that gives data descriptors priority over instance variables, instance variables priority over non-data -descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. The -full C implementation can be found in :c:func:`PyObject_GenericGetAttr()` in -`Objects/object.c <http://svn.python.org/view/python/trunk/Objects/object.c?view=markup>`_\. +descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. +The full C implementation can be found in :c:func:`PyObject_GenericGetAttr()` in +:source:`Objects/object.c`. For classes, the machinery is in :meth:`type.__getattribute__` which transforms ``B.x`` into ``B.__dict__['x'].__get__(None, B)``. In pure Python, it looks @@ -131,9 +131,7 @@ search using :meth:`object.__getattribute__`. Note, in Python 2.2, ``super(B, obj).m()`` would only invoke :meth:`__get__` if ``m`` was a data descriptor. In Python 2.3, non-data descriptors also get invoked unless an old-style class is involved. The implementation details are -in :c:func:`super_getattro()` in -`Objects/typeobject.c <http://svn.python.org/view/python/trunk/Objects/typeobject.c?view=markup>`_ -and a pure Python equivalent can be found in `Guido's Tutorial`_. +in :c:func:`super_getattro()` in :source:`Objects/typeobject.c`. .. _`Guido's Tutorial`: http://www.python.org/2.2.3/descrintro.html#cooperation @@ -308,10 +306,9 @@ Running the interpreter shows how the function descriptor works in practice:: The output suggests that bound and unbound methods are two different types. While they could have been implemented that way, the actual C implementation of -:c:type:`PyMethod_Type` in -`Objects/classobject.c <http://svn.python.org/view/python/trunk/Objects/classobject.c?view=markup>`_ -is a single object with two different representations depending on whether the -:attr:`im_self` field is set or is *NULL* (the C equivalent of *None*). +:c:type:`PyMethod_Type` in :source:`Objects/classobject.c` is a single object +with two different representations depending on whether the :attr:`im_self` +field is set or is *NULL* (the C equivalent of *None*). Likewise, the effects of calling a method object depend on the :attr:`im_self` field. If set (meaning bound), the original function (stored in the |