What exactly is a Python module? From what I've read, it seems like any Python file can be considered a module.
With that in mind, is it true that python modules are needed if object orientation is to be used in a python program?
asked Apr 5, 2015 at 22:46
Vimzy
1,9858 gold badges30 silver badges58 bronze badges
-
Yes, the two are synonymous.Malik Brahimi– Malik Brahimi2015年04月05日 22:47:07 +00:00Commented Apr 5, 2015 at 22:47
-
1By object orientation do you mean one class per file? Because those are not synonymous.kojiro– kojiro2015年04月05日 22:50:26 +00:00Commented Apr 5, 2015 at 22:50
-
I think your professor is getting at the fact that you can have multiple classes and such in one module.keyser– keyser2015年04月05日 22:55:18 +00:00Commented Apr 5, 2015 at 22:55
-
@keyser So do you think the statement would be false or true? Because a single module can have a class in it, and we can create instances of that without having that class be located in another module. Making his statement false, no?Vimzy– Vimzy2015年04月05日 23:30:54 +00:00Commented Apr 5, 2015 at 23:30
-
Well, it depends on the interpretation of "modules". A python module will be used, but multiple isn't necessary. Just make sure you understand what a module is and you can't go wrong.keyser– keyser2015年04月05日 23:33:22 +00:00Commented Apr 5, 2015 at 23:33
1 Answer 1
Your question is very unclear, but every program requires at least one module in order to run code, regardless of whether your code is object oriented or not, though it is typical to create different files for different purposes.
answered Apr 5, 2015 at 22:49
Malik Brahimi
16.8k7 gold badges47 silver badges76 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py