mirror of https://github.com/python/cpython.git
+ 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.
This commit is contained in:
parent
c39553ad0d
commit
f33532cfef
14
Lib/pydoc.py
14
Lib/pydoc.py
|
@ -646,8 +646,8 @@ def spillproperties(msg, attrs, predicate):
|
|||
doc = self.markup(value.__doc__, self.preformat,
|
||||
funcs, classes, mdict)
|
||||
push('<dd><tt>%s</tt></dd>\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 @@ def spilldata(msg, attrs, predicate):
|
|||
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 @@ def spillproperties(msg, attrs, predicate):
|
|||
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 @@ def spilldata(msg, attrs, predicate):
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue