Skip to content

Commit df826f3

Browse files
authored
Clarify the inspect.getmembers predicate parameter (#6615)
Previously, the predicate parameter was mentioned, but what it was to be called with was not documented and required either trial-and-error or looking into the source to find that it is called with the `value`, or second item, of the full members list. This change addresses what the predicate will receive, as well as does some light formatting to make this clear.
1 parent 0250de4 commit df826f3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/library/inspect.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,10 @@ attributes:
247247

248248
.. function:: getmembers(object[, predicate])
249249

250-
Return all the members of an object in a list of (name, value) pairs sorted by
251-
name. If the optional *predicate* argument is supplied, only members for which
252-
the predicate returns a true value are included.
250+
Return all the members of an object in a list of ``(name, value)``
251+
pairs sorted by name. If the optional *predicate* argument—which will be
252+
called with the ``value`` object of each member—is supplied, only members
253+
for which the predicate returns a true value are included.
253254

254255
.. note::
255256

0 commit comments

Comments
 (0)