Python `__all__`: Blocking wildcard imports with a fake name

Python `__all__`: Blocking wildcard imports with a fake name

Want to guarantee that no one can run “from .. import *” on your Python module? Include a non-existent name in the __all__ list:

x = 100
y = [10, 20, 30]
__all__ = ['YOU_SHOULD_NOT_USE_IMPORT_*']

Using “from .. import *” on this module will result in an error!