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.
This commit is contained in:
Brian Curtin 2018-04-26 19:48:26 -04:00 committed by GitHub
parent 0250de4819
commit df826f36e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -247,9 +247,10 @@ attributes:
.. function:: getmembers(object[, predicate])
Return all the members of an object in a list of (name, value) pairs sorted by
name. If the optional *predicate* argument is supplied, only members for which
the predicate returns a true value are included.
Return all the members of an object in a list of ``(name, value)``
pairs sorted by name. If the optional *predicate* argument—which will be
called with the ``value`` object of each member—is supplied, only members
for which the predicate returns a true value are included.
.. note::