Created
April 10, 2015 16:58
-
-
Save Averroes/7cfcf48228a6d25cf637 to your computer and use it in GitHub Desktop.
monkeypatching modules on import
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
| from postimport import when_imported | |
| @when_imported('threading') | |
| def warn_threads(mod): | |
| print('Threads? Are you crazy?') | |
| if __name__ == '__main__': | |
| import threading |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment