PyDocs

Nav

Python Runtime Services

iscode

inspect

function (source)
  • iscode(object)
Return true if the object is a code object.

Code objects provide these attributes:
    co_argcount         number of arguments (not including *, ** args
                        or keyword only arguments)
    co_code             string of raw compiled bytecode
    co_cellvars         tuple of names of cell variables
    co_consts           tuple of constants used in the bytecode
    co_filename         name of file in which this code object was created
    co_firstlineno      number of first line in Python source code
    co_flags            bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
                        | 16=nested | 32=generator | 64=nofree | 128=coroutine
                        | 256=iterable_coroutine | 512=async_generator
                        | 0x4000000=has_docstring
    co_freevars         tuple of names of free variables
    co_posonlyargcount  number of positional only arguments
    co_kwonlyargcount   number of keyword only arguments (not including ** arg)
    co_name             name with which this code object was defined
    co_names            tuple of names other than arguments and function locals
    co_nlocals          number of local variables
    co_stacksize        virtual machine stack space required
    co_varnames         tuple of names of arguments and local variables
    co_qualname         fully qualified function name

    co_lines()          returns an iterator that yields successive bytecode ranges
    co_positions()      returns an iterator of source code positions for each bytecode instruction
    replace()           returns a copy of the code object with a new values
0 Examples
No examples for inspect/iscode.
See Also
No see-alsos for inspect/iscode
0 Notes
No notes for iscode