summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2018-04-26 23:48:26 (GMT)
committerGitHub <noreply@github.com>2018-04-26 23:48:26 (GMT)
commitdf826f36e081211ef645a9025b60c4d84abb5419 (patch)
tree73034e5b2cad0c06c98e902328ff8105ef9b7e07
parent0250de48199552cdaed5a4fe44b3f9cdb5325363 (diff)
downloadcpython-df826f36e081211ef645a9025b60c4d84abb5419.zip
cpython-df826f36e081211ef645a9025b60c4d84abb5419.tar.gz
cpython-df826f36e081211ef645a9025b60c4d84abb5419.tar.bz2
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.
-rw-r--r--Doc/library/inspect.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index bc4316f..7db6ca6 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -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::