[Python-Dev] Patch 1644818: Allow importing built-in submodules

"Martin v. Löwis" martin at v.loewis.de
Mon Mar 12 22:24:45 CET 2007


Miguel Lobo schrieb:
>     It won't benefit the Python core either, because we just don't use
>     builtin submodules. In fact, I find the notion of builtin submodules
>     somewhat strange.
> 
> 
> Please excuse my curiosity, but why do you find it strange?

Normally, the builtin modules are the ones that are shipped in Python
core. I know you can get a bigger builtins list through freeze, or
through a custom Setup.local, but it is fairly uncommon to do that.

Also, having extension modules in a namespace is something that I
would normally not do. I couldn't tell off-hand whether having
extension modules in a package would even work (but apparently,
it does), so I would make them global modules just to be safe.
Also, they normally have a canonical naming: if they wrap a library
called libfoo, the extension module would normally be called
foo.so or foomodule.so (on a Unix system; foo.pyd on Windows).
As DLLs don't have hierarchical names, extension modules don't
need hierarchical names, either.

Putting these two boundary cases (additional builtin modules,
and modules in packages) is something that I find unlikely
to run into.

Regards,
Martin


More information about the Python-Dev mailing list