module confusion
Robert Kern
robert.kern at gmail.com
Tue Oct 2 13:06:48 EDT 2007
Lawrence D'Oliveiro wrote:
> In message <mailman.1379.1191301581.2658.python-list at python.org>, Robert
> Kern wrote:
>
>> Not all of the modules in a package are imported by importing the
>> top-level package.
>
> You can't import packages, only modules.
>
>> os.path is a particularly weird case because it is just an alias to the
>> platform-specific path-handling module; os is not a package.
>
> os is a module, os.path is a variable within that module. That's all there
> is to it.
Yes, but os.path is also module. That's why I said it was a weird case.
In [1]: import os
In [2]: type(os.path)
Out[2]: <type 'module'>
--
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