Last active
June 29, 2016 20:22
-
-
Save tritium21/84d3d0a13ea562c579c3 to your computer and use it in GitHub Desktop.
These are my hacks
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
# Punich those who import * | |
__all__ = type('__all__', (object,), {'__getitem__': lambda self, index: __import__('types').FunctionType(compile('raise ImportError("Loli Haet \'from foo import *\'")', __name__, 'single'), globals())()})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seriously, If you use this, you are doing hacks. I mean, seriously, you are breaking (intentionally) parts of the import mechanism. If you don't want people to
from your_module import *
. do__all__ = []
. The point of this is to punish the importer