Data encapsulation, inheritance and polymorphism are the three main characteristics of object-oriented.
Data encapsulation:
In a class, such as the student class (initialization and name and score two properties), each instance has its own name,score of the data. We can access this data through functions, such as printing a student's score. Directly define an output function, output name and corresponding score.
However, since the student instance itself has this data, to access this data, there is no need to access from outside the function, you can directly within the student class to define the function of accessing the data, so that the "data" to encapsulate it, The functions of these encapsulated data are associated with the student class itself, which we call the method of the class. In this way, we look at the student class from the outside, just need to know that the creation of the instance needs to give name and score, and how to print, is defined within the student class, the data and logic is "encapsulated", the call is easy, but do not know the details of the internal implementation. One point, Python and static languages, Python allows you to bind any data to an instance variable, that is, for two instance variables, although they are different instances of the same class, the variable names you have may be different.
Python encapsulation, inheritance, and polymorphism