
__all__ is very useful when doing import *, which is frowned upon. As an alternative, allow modules to contain a function called __init__ that defines that module's exported symbols by way of the global statement. By importing modules that are used, but not intended to be exported, inside the __init__ function, programmers avoid cases such as the unintentional 'somemodule.sys' (referring to a module by its non-canonical name) that makes it harder to refactor larger projects. Before: __all__ = ['a', 'b'] import sys def a(): pass def b(): pass def c(): pass After: def __init__(): global a, b import sys def a(): pass def b(): pass def c(): pass __init__()

Daniel Holth wrote:
This is already possible and used in modules where you don't want to clutter up the global namespace. Where's the novelty ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2011)
2011-06-20: EuroPython 2011, Florence, Italy 44 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/

Daniel Holth wrote:
This is already possible and used in modules where you don't want to clutter up the global namespace. Where's the novelty ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2011)
2011-06-20: EuroPython 2011, Florence, Italy 44 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
participants (2)
-
Daniel Holth
-
M.-A. Lemburg