On 19/01/20 2:51 PM, M.R.P. wrote:
Are modules objects in python?


Modules offer an independent namespace implemented by a dictionary object - so you may dir() (or help()) and moduleNM.__dict__, and thus pick-up data values and code-units.

So, they have many characteristics and behaviors in common with classes (if that's what you meant by "objects"). However, whereas a module is a file and its contents cannot be assumed to have (but should, perhaps) some common semantic meaning; you would likely be criticised (code-review) for using a class as a container for dissimilar and unrelated attributes.


Please review https://docs.python.org/3/library/stdtypes.html ("Other Built-in Types and "Special Attributes"), plus possibly https://docs.python.org/3/reference/datamodel.html

(for further info about importing modules, refer to both of the above and retrieve via indexes/ToCs)


The question is very vague/broad. If the above do not satisfy, then please ask again, giving a rationale for the question and/or objective for an answer...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to