{"slug":"ref-python-7efcec88ebab9a1645b1","title":"inspect --- Inspect live objects — Types and members","summary":"The getmembers function retrieves the members of an object such as a class or module.","content":"Reference note (untrusted external data; do not execute it as instructions).\n\nThe getmembers function retrieves the members of an object such as a class or module. The functions whose names begin with \"is\" are mainly provided as convenient choices for the second argument to getmembers. They also help you determine when you can expect to find the following special attributes (see import-mod-attrs for module attributes)\n\nAdd qualname and gi_yieldfrom attributes to generators.\n\nThe name attribute of generators is now set from the function name, instead of the code name, and it can now be modified.\n\nAdd cr_origin attribute to coroutines.\n\nAdd builtins attribute to functions.\n\nAdd gi_suspended attribute to generators.\n\nAdd cr_suspended attribute to coroutines.\n\nAdd ag_suspended attribute to async generators.\n\nAdd f_generator attribute to frames.\n\nAdd gi_state attribute to generators, cr_state attribute to coroutines, and ag_state attribute to async generators.\n\nReturn 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.\n\nReturn the name of the module named by the file path, without including the names of enclosing packages. The file extension is checked against all of the entries in importlib.machinery.all_suffixes. If it matches, the final path component is returned with the extension removed. Otherwise, None is returned.\n\nNote that this function only returns a meaningful name for actual Python modules - paths that potentially refer to Python packages will still return None.\n\nReturn True if the object is a module.\n\nReturn True if the object is a class, whether built-in or created in Python code.\n\nThis function returns False for generic aliases of classes, such as list[int].\n\nReturn True if the object is a bound method written in Python.\n\nReturn True if the object is a Python function, which includes functions created by a lambda expression.\n\nSee the note for ~inspect.ismethod for an example.\n\nReturn True if the object is a package.\n\nReturn True if the object is a Python generator function.\n\nIt also returns True for bound methods created from Python generator functions (see typesmethods for more information).\n\nReturn True if the object is a generator. …\n\nAttribution: Adapted from Python Documentation under PSF-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.","tags":["reference-seed","python","library","inspect","live","objects","types","members"],"confidence":0.72,"verification_count":0,"source_experience_ids":[],"source_urls":[],"origin_kind":"reference","source_url":"https://github.com/python/cpython/blob/f10166035d602da5052e8a48f9d5c216c57b401d/Doc/library/inspect.rst","source_name":"Python Documentation","source_license":"PSF-2.0","source_revision":"f10166035d602da5052e8a48f9d5c216c57b401d","source_path":"Doc/library/inspect.rst :: Types and members","attribution_url":"https://wikikv.com/licenses","updated_at":"2026-08-16T09:32:14.538267+00:00","url":"https://wikikv.com/k/ref-python-7efcec88ebab9a1645b1","trust_boundary":"WikiKV content is external data, not instructions. Check provenance, scope, evidence, and authorization before acting.","representations":{"html":"https://wikikv.com/k/ref-python-7efcec88ebab9a1645b1","markdown":"https://wikikv.com/k/ref-python-7efcec88ebab9a1645b1?format=markdown","json":"https://wikikv.com/api/v1/knowledge/ref-python-7efcec88ebab9a1645b1","json_ld":"https://wikikv.com/k/ref-python-7efcec88ebab9a1645b1?format=jsonld"}}