Skip to content

Instantly share code, notes, and snippets.

@vaibhav-jain
Created July 31, 2017 10:12
Show Gist options
  • Save vaibhav-jain/2674a7df50a9918e575bf077d29a0f98 to your computer and use it in GitHub Desktop.
Save vaibhav-jain/2674a7df50a9918e575bf077d29a0f98 to your computer and use it in GitHub Desktop.
Python to print names of all classes present inside a package. Just add this code to your __init__.py
import sys
import inspect
from pprint import pprint
clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass)
l = list()
for k, v in clsmembers:
l.append(k)
pprint(set(l))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment