Created
December 10, 2010 10:27
-
-
Save elishowk/736062 to your computer and use it in GitHub Desktop.
dynamically gets a class given its name and the name of its module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dynamic_get_class(mod_name, class_name): | |
"""returns a class given its name""" | |
mod = __import__(mod_name, globals(), locals(), [class_name]) | |
return getattr(mod, class_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment