Reprint Please specify source: http://www.cnblogs.com/codefish/p/5032753.html
Before I understand Python's package, class, and module, I've been referring to him as a dll,c# class, a reference to the namespace, which is actually different from C #, and we'll look at these units from a macro perspective.
One, class
The definition of a class appears in each language, and is almost the smallest packaging unit in OOP, allowing for higher reuse
Two, module
We know that in C # if a new folder is created, and then any class file is added under that folder, the default is to name it this way
folder. Class Name
In this way, all the classes under a folder are encapsulated under a namespace, which is easy to reuse, and the modules are similar, with a single file as a module, referenced by humans as the module name when other landlord references
In summary, each file ending with a. PY is a module (moudle)
Three, Package
In the upper layer of the namespace, which is the DLL assembly, which encapsulates the class text more than one layer, Python uses a folder containing __init__.py to specialize the folder into a package
The package here is the aggregation of modules, wrapped in the same folder.
Four, other
Some students notice two different kinds of grammar when quoting.
__author__ ' Bruce ' from Import darkred Import Humans if __name__ ' __main__ ' : = darkred () dark_red.printinfo () Pass
If you look at the subdivision point, you will see: From Color.Red, the general from behind is directly followed by the inclusion of the upper space, and import can only follow a level of space.
Reprint Please specify source: http://www.cnblogs.com/codefish/p/5032753.html
[Python basics] things about packages, classes, modules