summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libinspect.tex27
-rw-r--r--Doc/lib/libtypes.tex24
2 files changed, 47 insertions, 4 deletions
diff --git a/Doc/lib/libinspect.tex b/Doc/lib/libinspect.tex
index 5cabb80..b61a6e0 100644
--- a/Doc/lib/libinspect.tex
+++ b/Doc/lib/libinspect.tex
@@ -180,13 +180,32 @@ Note:
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.
+ properties (defined in Python), getsets, and members. The latter two are
+ defined in C and there are more specific tests available for those types,
+ which is robust across Python implementations. Typically, data descriptors
+ will also have __name__ and __doc__ attributes (properties, getsets, and
+ members have both of these attributes), but this is not guaranteed.
\versionadded{2.3}
\end{funcdesc}
+\begin{funcdesc}{isgetsetdescriptor}{object}
+ Return true if the object is a getset descriptor.
+
+ getsets are attributes defined in extension modules via \code{PyGetSetDef}
+ structures. For Python implementations without such types, this method will
+ always return \code{False}.
+\versionadded{2.5}
+\end{funcdesc}
+
+\begin{funcdesc}{ismemberdescriptor}{object}
+ Return true if the object is a member descriptor.
+
+ Member descriptors are attributes defined in extension modules via
+ \code{PyMemberDef} structures. For Python implementations without such
+ types, this method will always return \code{False}.
+\versionadded{2.5}
+\end{funcdesc}
+
\subsection{Retrieving source code
\label{inspect-source}}
diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex
index 19d2faa..5e0c5a6 100644
--- a/Doc/lib/libtypes.tex
+++ b/Doc/lib/libtypes.tex
@@ -180,6 +180,30 @@ The type of buffer objects created by the
\function{buffer()}\bifuncindex{buffer} function.
\end{datadesc}
+\begin{datadesc}{DictProxyType}
+The type of dict proxies, such as \code{TypeType.__dict__}.
+\end{datadesc}
+
+\begin{datadesc}{NotImplementedType}
+The type of \code{NotImplemented}
+\end{datadesc}
+
+\begin{datadesc}{GetSetDescriptorType}
+The type of objects defined in extension modules with \code{PyGetSetDef}, such
+as \code{FrameType.f_locals} or \code{array.array.typecode}. This constant is
+not defined in implementations of Python that do not have such extension
+types, so for portable code use \code{hasattr(types, 'GetSetDescriptorType')}.
+\versionadded{2.5}
+\end{datadesc}
+
+\begin{datadesc}{MemberDescriptorType}
+The type of objects defined in extension modules with \code{PyMemberDef}, such
+as \code {datetime.timedelta.days}. This constant is not defined in
+implementations of Python that do not have such extension types, so for
+portable code use \code{hasattr(types, 'MemberDescriptorType')}.
+\versionadded{2.5}
+\end{datadesc}
+
\begin{datadesc}{StringTypes}
A sequence containing \code{StringType} and \code{UnicodeType} used to
facilitate easier checking for any string object. Using this is more