Runtime Data Attributes
code.co_names
Names referenced by bytecode operations that use the name table, such as global or attribute lookup. It is not a list of every local identifier.
Formal Syntax & Structure
python syntaxpython
code.co_namesReturn Value
tuple[str, ...]
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
def f(text): return len(text)code = f.__code__print(('len' in code.co_names,'text' in code.co_names))