0
Class like modules?
Is a class the same as a module? Since a class is a group of related functions inside a container? Can we say that they are the same or not? ex: with the random module --> random = Class randint = method of the random "class" choice = method of the random "class" So is it the same? If not , can we use it as it it was that? PS: Im new to oop
1 Odpowiedź
+ 1
class is not a module, but module can be a class.
modules can contain classes, functions, constants, anything else. they are the same pieces of code.
difference is that you don't write everything in one script, instead you write logical parts of your code as reusable modules and import them to your main script.