summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:09:02 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:09:02 (GMT)
commite59e2bab8fe0fc3d20e815ac0f9b83d361d0d715 (patch)
tree1ceec154b81d1404ebe43a37d9758df8d1c3380a /Lib/inspect.py
parente86a59af886d6c0f58f53e42878a25e48627fed1 (diff)
downloadcpython-e59e2bab8fe0fc3d20e815ac0f9b83d361d0d715.zip
cpython-e59e2bab8fe0fc3d20e815ac0f9b83d361d0d715.tar.gz
cpython-e59e2bab8fe0fc3d20e815ac0f9b83d361d0d715.tar.bz2
Patch #711902: Cause pydoc to show data descriptor __doc__ strings.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 4baebe0..a2ea739 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -78,6 +78,16 @@ def ismethoddescriptor(object):
and not isfunction(object)
and not isclass(object))
+def 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."""
+ return (hasattr(object, "__set__") and hasattr(object, "__get__"))
+
def isfunction(object):
"""Return true if the object is a user-defined function.