Skip to content

Instantly share code, notes, and snippets.

@jeakwon
Created August 4, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeakwon/dffd3444d832388277b1fdcdfb46c3fa to your computer and use it in GitHub Desktop.
Save jeakwon/dffd3444d832388277b1fdcdfb46c3fa to your computer and use it in GitHub Desktop.
inspect class args
import inspect
class foo:
def __init__(self, a, b=10, *c, **d):
values = inspect.getargvalues(inspect.currentframe())[3]
print(values)
# {'d': {}, 'c': (), 'b': 10, 'a': 1, 'self': <__main__.foo object at 0x0000021BD7DEECF8>}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment