Skip to content

Instantly share code, notes, and snippets.

@DarinMao
Created April 27, 2021 14:25
Show Gist options
  • Save DarinMao/ed4a1590da0740583b13d58c5f30c8fd to your computer and use it in GitHub Desktop.
Save DarinMao/ed4a1590da0740583b13d58c5f30c8fd to your computer and use it in GitHub Desktop.
function to get code object constructor arguments from a function
def code_args(func):
return (
func.__code__.co_argcount,
func.__code__.co_posonlyargcount,
func.__code__.co_kwonlyargcount,
func.__code__.co_nlocals,
func.__code__.co_stacksize,
func.__code__.co_flags,
func.__code__.co_code,
func.__code__.co_consts,
func.__code__.co_names,
func.__code__.co_varnames,
func.__code__.co_filename,
func.__code__.co_name,
func.__code__.co_firstlineno,
func.__code__.co_lnotab,
func.__code__.co_freevars,
func.__code__.co_cellvars,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment