Created
March 1, 2013 19:18
-
-
Save jaytaylor/5067034 to your computer and use it in GitHub Desktop.
One-liner for dynamically importing a class from a module.
This file contains hidden or 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
| imp = lambda path: reduce(lambda module, next: getattr(module, next), path.split('.')[1:], __import__(path[0:path.index('.')])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment