Python classes and functions

 

The difference between Python classes and functions is that classes can have variables and various methods, while functions do not. The function can only be executed, either returning or not returning a value.

If the module does not declare the class as private, other modules can use this class by importing this module and then calling it with "module name.class name".

If you are inclined to functional programming, you must use functions. If you are accustomed to object-oriented, you must dominate the class. 
If you need to put the function and data together, you must use the class. The function can only pass the data back and forth, not save it.

Guess you like

Origin www.cnblogs.com/michaelxun/p/12680237.html