From f33532cfef6f613200c2ba5e7fe09ce492fd63e4 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 25 Sep 2001 06:30:51 +0000 Subject: + Display property functions in the same order they're specified to property() (get, set, del; not set, get, del). + Change "Data defined/inherited in ..." header lines to "Data and non-method functions defined/inherited in ...". Things like the value of __class__, and __new__, and class vrbls like the i in class C: i = int show up in this section too. I don't think it's worth a separate section to distinguish them from non-callable attrs, and there's no obvious reliable way to distinguish callable from non-callable attrs anyway. --- Lib/pydoc.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 78ec714..a6f026b 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -646,8 +646,8 @@ TT { font-family: lucidatypewriter, lucida console, courier } doc = self.markup(value.__doc__, self.preformat, funcs, classes, mdict) push('
%s
\n' % doc) - for attr, tag in [("fset", " setter"), - ("fget", " getter"), + for attr, tag in [("fget", " getter"), + ("fset", " setter"), ("fdel", " deleter")]: func = getattr(value, attr) if func is not None: @@ -713,7 +713,7 @@ TT { font-family: lucidatypewriter, lucida console, courier } lambda t: t[1] == 'static method') attrs = spillproperties("Properties %s" % tag, attrs, lambda t: t[1] == 'property') - attrs = spilldata("Data %s" % tag, attrs, + attrs = spilldata("Data and non-method functions %s" % tag, attrs, lambda t: t[1] == 'data') assert attrs == [] @@ -1030,8 +1030,8 @@ class TextDoc(Doc): if doc: push(self.indent(doc)) need_blank_after_doc = 1 - for attr, tag in [("fset", " setter"), - ("fget", " getter"), + for attr, tag in [("fget", " getter"), + ("fset", " setter"), ("fdel", " deleter")]: func = getattr(value, attr) if func is not None: @@ -1081,8 +1081,8 @@ class TextDoc(Doc): lambda t: t[1] == 'static method') attrs = spillproperties("Properties %s:\n" % tag, attrs, lambda t: t[1] == 'property') - attrs = spilldata("Data %s:\n" % tag, attrs, - lambda t: t[1] == 'data') + attrs = spilldata("Data and non-method functions %s:\n" % tag, + attrs, lambda t: t[1] == 'data') assert attrs == [] # Split off the attributes inherited from the next class (note -- cgit v0.12