File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,24 @@ attributes:
275275 listed in the metaclass' custom :meth: `__dir__ `.
276276
277277
278+ .. function :: getmembers_static(object[, predicate])
279+
280+ Return all the members of an object in a list of ``(name, value) ``
281+ pairs sorted by name without triggering dynamic lookup via the descriptor
282+ protocol, __getattr__ or __getattribute__. Optionally, only return members
283+ that satisfy a given predicate.
284+
285+ .. note ::
286+
287+ :func: `getmembers_static ` may not be able to retrieve all members
288+ that getmembers can fetch (like dynamically created attributes)
289+ and may find members that getmembers can't (like descriptors
290+ that raise AttributeError). It can also return descriptor objects
291+ instead of instance members in some cases.
292+
293+ .. versionadded :: 3.11
294+
295+
278296.. function :: getmodulename(path)
279297
280298 Return the name of the module named by the file *path *, without including the
Original file line number Diff line number Diff line change @@ -207,6 +207,13 @@ fractions
207207 (Contributed by Mark Dickinson in :issue: `44547 `.)
208208
209209
210+ inspect
211+ -------
212+ * Add :func: `inspect.getmembers_static `: return all members without
213+ triggering dynamic lookup via the descriptor protocol. (Contributed by
214+ Weipeng Hong in :issue: `30533 `.)
215+
216+
210217math
211218----
212219* Add :func: `math.exp2 `: return 2 raised to the power of x.
You can’t perform that action at this time.
0 commit comments