diff options
author | Weipeng Hong <hongweichen8888@sina.com> | 2021-12-01 19:23:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 19:23:46 (GMT) |
commit | c2bb29ce9ae4adb6a8123285ad3585907cd4cc73 (patch) | |
tree | 2a7f72204a9b9adc40f2da3740588527647de4be /Doc/library/inspect.rst | |
parent | ee94aa0850191712e6adfc1f4a9df08ec3240195 (diff) | |
download | cpython-c2bb29ce9ae4adb6a8123285ad3585907cd4cc73.zip cpython-c2bb29ce9ae4adb6a8123285ad3585907cd4cc73.tar.gz cpython-c2bb29ce9ae4adb6a8123285ad3585907cd4cc73.tar.bz2 |
bpo-30533: Add docs for `inspect.getmembers_static` (#29874)
* Add docs for `inspect.getmembers_static`
* update
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r-- | Doc/library/inspect.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 1074f97..711f510 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -275,6 +275,24 @@ attributes: listed in the metaclass' custom :meth:`__dir__`. +.. function:: getmembers_static(object[, predicate]) + + Return all the members of an object in a list of ``(name, value)`` + pairs sorted by name without triggering dynamic lookup via the descriptor + protocol, __getattr__ or __getattribute__. Optionally, only return members + that satisfy a given predicate. + + .. note:: + + :func:`getmembers_static` may not be able to retrieve all members + that getmembers can fetch (like dynamically created attributes) + and may find members that getmembers can't (like descriptors + that raise AttributeError). It can also return descriptor objects + instead of instance members in some cases. + + .. versionadded:: 3.11 + + .. function:: getmodulename(path) Return the name of the module named by the file *path*, without including the |