From e59e2bab8fe0fc3d20e815ac0f9b83d361d0d715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 3 May 2003 09:09:02 +0000 Subject: Patch #711902: Cause pydoc to show data descriptor __doc__ strings. --- Lib/inspect.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lib/inspect.py') diff --git a/Lib/inspect.py b/Lib/inspect.py index 4baebe0c6f..a2ea7390bd 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. -- cgit v1.2.1