Add markup to new function descriptions.

This commit is contained in:
Georg Brandl 2007-10-21 10:32:54 +00:00
parent 63fa168326
commit 5c174bbd84
1 changed files with 19 additions and 18 deletions

View File

@ -265,30 +265,31 @@ Note:
.. function:: ismethoddescriptor(object) .. function:: ismethoddescriptor(object)
Return true if the object is a method descriptor, but not if ismethod() or Return true if the object is a method descriptor, but not if :func:`ismethod`
isclass() or isfunction() are true. or :func:`isclass` or :func:`isfunction` are true.
This is new as of Python 2.2, and, for example, is true of int.__add__. An This is new as of Python 2.2, and, for example, is true of
object passing this test has a __get__ attribute but not a __set__ attribute, ``int.__add__``. An object passing this test has a :attr:`__get__` attribute
but beyond that the set of attributes varies. __name__ is usually sensible, and but not a :attr:`__set__` attribute, but beyond that the set of attributes
__doc__ often is. varies. :attr:`__name__` is usually sensible, and :attr:`__doc__` often is.
Methods implemented via descriptors that also pass one of the other tests return Methods implemented via descriptors that also pass one of the other tests
false from the ismethoddescriptor() test, simply because the other tests promise return false from the :func:`ismethoddescriptor` test, simply because the
more -- you can, e.g., count on having the im_func attribute (etc) when an other tests promise more -- you can, e.g., count on having the
object passes ismethod(). :attr:`im_func` attribute (etc) when an object passes :func:`ismethod`.
.. function:: isdatadescriptor(object) .. function:: isdatadescriptor(object)
Return true if the object is a data descriptor. Return true if the object is a data descriptor.
Data descriptors have both a __get__ and a __set__ attribute. Examples are Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute.
properties (defined in Python), getsets, and members. The latter two are Examples are properties (defined in Python), getsets, and members. The
defined in C and there are more specific tests available for those types, which latter two are defined in C and there are more specific tests available for
is robust across Python implementations. Typically, data descriptors will also those types, which is robust across Python implementations. Typically, data
have __name__ and __doc__ attributes (properties, getsets, and members have both descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes
of these attributes), but this is not guaranteed. (properties, getsets, and members have both of these attributes), but this is
not guaranteed.
.. versionadded:: 2.3 .. versionadded:: 2.3
@ -309,8 +310,8 @@ Note:
Return true if the object is a member descriptor. Return true if the object is a member descriptor.
Member descriptors are attributes defined in extension modules via Member descriptors are attributes defined in extension modules via
``PyMemberDef`` structures. For Python implementations without such types, this ``PyMemberDef`` structures. For Python implementations without such types,
method will always return ``False``. this method will always return ``False``.
.. versionadded:: 2.5 .. versionadded:: 2.5