combination
What is a combination
It refers to a combination of attributes in the object, another object.
Why use a combination of
To reduce code redundancy
Package
What is the package
It refers to a pile of package properties (characteristics and skills) encapsulated into an object
Why package
The purpose of the package for easier access by the object properties may be obtained. Manner properties
Packaging - Hide
Hidden package in python just a manifestation
How to Hide
Defined within the class, all data attributes and methods to attribute the beginning of __
will be hidden inside the python (deformation), so that the outside can not "direct" access to the internal properties at the beginning of class __
Hidden purpose
Logic important data obtained more rigorous, thus ensuring data security.
How to call a hidden attribute
Interface: privacy attributes via an interface package, in doing business logic interface processing, and then returns to the caller data
property
What is the property
The method of python decorators built, mainly to the use of an internal class
Why use property
When object calls a method, the object method () becomes the object. The method would look for a common data attributes, follow the principle of a unified access
How to use the property
@property
Polymorphism
What is polymorphic
Polymorphism refers to the various forms of the same thing
Polymorphic object
Written standardized and unified sub-categories, in order to allow users to more easily call the same function method
Abstract class
What is an abstract class
abc module abstract_class
Abstract class purpose
The subclass must follow a set of mandatory standards of the parent class
Ducks type
In the current object is not sure what the situation was, but you look like a duck, then you're a duck type.
In python, we do not recommend the use of abstract classes mandatory restrictions defined subclasses, but it is recommended classes follow the duck type.
Inheritance:
Scalability coupling is too high, the difference between the programDuck Type:
low coupling, scalable procedure strong