Skip to content

Instantly share code, notes, and snippets.

@clbarnes
Created July 29, 2019 15:43
Show Gist options
  • Save clbarnes/edd28ea32010eb159b34b075687bb49e to your computer and use it in GitHub Desktop.
Save clbarnes/edd28ea32010eb159b34b075687bb49e to your computer and use it in GitHub Desktop.
Get the fully-qualified class name of a python object
def classname(obj):
cls = type(obj)
module = cls.__module__
name = cls.__qualname__
if module is not None and module != "__builtin__":
name = module + "." + name
return name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment