Modules Objects in Python

Chris Angelico rosuav at gmail.com
Sat Jan 18 21:21:38 EST 2020


On Sun, Jan 19, 2020 at 12:56 PM M.R.P. <blackzen1101 at gmail.com> wrote:
>
> Are modules objects in python?

Yes, modules are objects. You can import a module, and then work with
it as any other object. You can have a dictionary mapping names to
modules (Python has one of these internally). They have a type, they
can have methods (although it's not common), and they have attributes
including a docstring and some metadata.

ChrisA


More information about the Python-list mailing list