bpo-36401: Have help() show readonly properties separately (GH-12517) · python/cpython@62be338 (original) (raw)
`@@ -203,6 +203,8 @@ def classify_class_attrs(object):
`
203
203
`for (name, kind, cls, value) in inspect.classify_class_attrs(object):
`
204
204
`if inspect.isdatadescriptor(value):
`
205
205
`kind = 'data descriptor'
`
``
206
`+
if isinstance(value, property) and value.fset is None:
`
``
207
`+
kind = 'readonly property'
`
206
208
`results.append((name, kind, cls, value))
`
207
209
`return results
`
208
210
``
`@@ -884,6 +886,8 @@ def spilldata(msg, attrs, predicate):
`
884
886
`lambda t: t[1] == 'class method')
`
885
887
`attrs = spill('Static methods %s' % tag, attrs,
`
886
888
`lambda t: t[1] == 'static method')
`
``
889
`+
attrs = spilldescriptors("Readonly properties %s:\n" % tag, attrs,
`
``
890
`+
lambda t: t[1] == 'readonly property')
`
887
891
`attrs = spilldescriptors('Data descriptors %s' % tag, attrs,
`
888
892
`lambda t: t[1] == 'data descriptor')
`
889
893
`attrs = spilldata('Data and other attributes %s' % tag, attrs,
`
`@@ -1341,6 +1345,8 @@ def spilldata(msg, attrs, predicate):
`
1341
1345
`lambda t: t[1] == 'class method')
`
1342
1346
`attrs = spill("Static methods %s:\n" % tag, attrs,
`
1343
1347
`lambda t: t[1] == 'static method')
`
``
1348
`+
attrs = spilldescriptors("Readonly properties %s:\n" % tag, attrs,
`
``
1349
`+
lambda t: t[1] == 'readonly property')
`
1344
1350
`attrs = spilldescriptors("Data descriptors %s:\n" % tag, attrs,
`
1345
1351
`lambda t: t[1] == 'data descriptor')
`
1346
1352
`attrs = spilldata("Data and other attributes %s:\n" % tag, attrs,
`