[Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.11,1.12
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sat, 03 May 2003 02:09:04 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv17854/Doc/lib
Modified Files:
libinspect.tex
Log Message:
Patch #711902: Cause pydoc to show data descriptor __doc__ strings.
Index: libinspect.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** libinspect.tex 23 Apr 2002 21:21:20 -0000 1.11
--- libinspect.tex 3 May 2003 09:09:01 -0000 1.12
***************
*** 162,165 ****
--- 162,190 ----
\end{funcdesc}
+ \begin{funcdesc}{ismethoddescriptor}{object}
+ Return true if the object is a method descriptor, but not if ismethod() or
+ isclass() or isfunction() are true.
+
+ This is new as of Python 2.2, and, for example, is true of int.__add__.
+ An object passing this test has a __get__ attribute but not a __set__
+ attribute, but beyond that the set of attributes varies. __name__ is
+ usually sensible, and __doc__ often is.
+
+ Methods implemented via descriptors that also pass one of the other
+ tests return false from the ismethoddescriptor() test, simply because
+ the other tests promise more -- you can, e.g., count on having the
+ im_func attribute (etc) when an object passes ismethod().
+ \end{funcdesc}
+
+ \begin{funcdesc}{isdatadescriptor}{object}
+ Return true if the object is a data descriptor.
+
+ Data descriptors have both a __get__ and a __set__ attribute. Examples are
+ properties (defined in Python) and getsets and members (defined in C).
+ Typically, data descriptors will also have __name__ and __doc__ attributes
+ (properties, getsets, and members have both of these attributes), but this
+ is not guaranteed.
+ \end{funcdesc}
+
\subsection{Retrieving source code
\label{inspect-source}}