Public imports

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Mon Dec 8 14:18:57 CET 2008

Márcio Faustino a écrit :
> Hi,
> Does Python support public imports instead of the default private?

Python has no notion of "public" or "private" !-)

> Something like D's "public import" (see <
> 2.0/module.html>)

Python imports don't work as D imports (as far as I can tell from the 
above link). The Python import statement binds imported name - whether 
the module object itself[1] or the explicitely[2] or implicitely[3] 
specified names from the module object - into the importing module's 

[1] import some_module
[2] from some_module import some_name
[3] from some_module import *

IOW, if module_b imports module_a and module_c import module_a, module_a 
will be accessible in module_c as module_b.module_a. If module_b import 
name_x from module_a and module_c imports module_b, name_x will be 
accessible in module_c as module_b.name_x. Etc, etc....


More information about the Python-list mailing list