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:
275
275
listed in the metaclass' custom :meth: `__dir__ `.
276
276
277
277
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
+
278
296
.. function :: getmodulename(path)
279
297
280
298
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
207
207
(Contributed by Mark Dickinson in :issue: `44547 `.)
208
208
209
209
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
+
210
217
math
211
218
----
212
219
* Add :func: `math.exp2 `: return 2 raised to the power of x.
You can’t perform that action at this time.
0 commit comments