Identifiers exposed by a package
Robert Kern
robert.kern at gmail.com
Sun Nov 1 01:41:52 EST 2009
Ben Finney wrote:
> Robert Kern <robert.kern at gmail.com> writes:
>
>> If you are going to expose symbols in your __init__.py, they should
>> not have the same name as any of the modules in the package.
>
> Would I be correct in assuming you make an exception for the package
> importing one of the modules in the package, and thereby making that
> module's identifier exposed?
>
> package_foo/
> __init__.py
> module_bar.py
>
> $ cat foo/__init__.py
> import module_bar
>
> Now the name ‘package_foo.module_bar’ will get the identifier already
> assigned within ‘package_foo/__init__.py’, but that identifier is the
> module anyway.
Yes.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list