Skip to content

Instantly share code, notes, and snippets.

@defparam
Last active August 17, 2022 13:04
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 defparam/1c06b7988232d21b8057eeb1aa72ef59 to your computer and use it in GitHub Desktop.
Save defparam/1c06b7988232d21b8057eeb1aa72ef59 to your computer and use it in GitHub Desktop.
Examine a python object
def examine(obj):
objl = dir(obj)
for item in objl:
print("%s: %s"%(item.ljust(40," "), type(getattr(obj, item))))
@defparam
Copy link
Author

Examines an object by iterating through all its attributes , printing them and printing their type.
Useful for printf-style debugging/analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment