---restore content starts---
Python Phase summary python installation:
First we need to install Python software, the teacher sent an installation package directly click to download the installation, according to the number of computer-based choice to download 64-bit. After the installation is successful, choose Anaconda3 (64-bit) from "Start" to select Jupyter notebook The following screen appears, waiting will jump to the Web interface, it can be used.
Python basic Syntax:
Identifier: consists of letters, numbers, and underscores, including English, numerals, and underscores (__), but cannot begin with a number. Identifiers that begin with an underscore are of special significance. Start with a single underscore the _foo class property, which is not directly accessible, is accessed through the interface provided by the class and cannot be imported with the FROM XXX import *; __foo, which begins with a double underscore, represents the private member of the class A __foo__ that begins with a double underscore and ends in a special method specific to Python, such as __init__ (), represents the constructor of a class.
The following is attached to some of the machine operation example diagram:
Introduction part: Object-oriented: definition and invocation of class
Classes are templates of objects that encapsulate the nature and behavior of the corresponding real entities
Practical results:
Custom Object sorting:
The sort method of the Python list type and the built-in sort function sorted (): Because of the extensibility of Python, each data type can be defined as a special method def__lt__ (Self,y) returns true as "small" than Y, which is ranked before, and returns false as greater than " , any custom class that is queued can use x<y such a comparison, as long as the class defines a special method __lt__
Example:
Inheritance mechanism for classes: code reuse
If two classes have a "general-special" logical relationship, then special classes can be defined as "subclasses" of the generic class, inheriting properties and methods from the "Parent class"
The subclass object can call the parent class method unless the method is redefined in the subclass (overwrite override)
Example:
Phase Summary:
Python is an object-oriented, literal translation of computer programming language, but also a powerful and perfect general-purpose language.
---restore content ends---
Python Phase Summary