Skip to content

Instantly share code, notes, and snippets.

@Averroes
Created April 10, 2015 16:58
Show Gist options
  • Select an option

  • Save Averroes/7cfcf48228a6d25cf637 to your computer and use it in GitHub Desktop.

Select an option

Save Averroes/7cfcf48228a6d25cf637 to your computer and use it in GitHub Desktop.
monkeypatching modules on import
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