Popular recipes tagged "__all__"http://code.activestate.com/recipes/tags/__all__/2011-08-12T20:24:11-07:00ActiveState Code Recipesusing `from somename.api import *` when somename is a single module (Python)
2011-08-12T20:24:11-07:00Ethan Furmanhttp://code.activestate.com/recipes/users/4177684/http://code.activestate.com/recipes/577839-using-from-somenameapi-import-when-somename-is-a-s/
<p style="color: grey">
Python
recipe 577839
by <a href="/recipes/users/4177684/">Ethan Furman</a>
(<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/import/">import</a>, <a href="/recipes/tags/modules/">modules</a>, <a href="/recipes/tags/__all__/">__all__</a>).
</p>
<p>Allow a module to export a subset of __all__, so a user can do <code>from module.api import *</code></p>
Enforce __all__ outside the 'import *' antipattern. (Python)
2011-05-12T03:30:41-07:00Daniel Holthhttp://code.activestate.com/recipes/users/4177955/http://code.activestate.com/recipes/577689-enforce-__all__-outside-the-import-antipattern/
<p style="color: grey">
Python
recipe 577689
by <a href="/recipes/users/4177955/">Daniel Holth</a>
(<a href="/recipes/tags/__all__/">__all__</a>).
</p>
<p>__all__ is supposed to define a module's API. This class lets you know when that contract is violated by raising a warning. As an alternative, raise AttributeError() instead to __all__ with an iron fist.</p>