Home>Article>Backend Development> What are the two programming methods in python language?

What are the two programming methods in python language?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-06-15 11:54:08 12439browse

Python is an interpreted, object-oriented, high-level programming language with dynamic data types.

Python was invented by Guido van Rossum at the end of 1989, and the first public release was released in 1991.

Like the Perl language, Python source code also follows the GPL (GNU General Public License) agreement.

Related recommendations: "python video"

What are the two programming methods in python language?

##Python programming:

Every Each module has a built-in variable named __name__. The value of this variable will change according to the way the module is called:

1). If this file is imported as a module, the value of __name__ The value is the module name;

2), if this file is executed directly, the value of __name__ is "__main__";

Programming method:

1), process-oriented: centered on instructions, data is processed by instructions, that is, how to organize code to solve problems;

2), object-oriented: centered on data, all processing codes revolve around Data expansion, that is, how to design a data structure to organize data, and provide processing operations allowed for such data to solve problems;

All data saved in a Python program is developed around the concept of objects, and is stored in the program All data are objects, and each object has an identity "id()", a type "type()" and a value "print"

For example: name="field" will end with "field "Create a string object whose identity is a pointer to its location in memory (address in memory), and name is the name that refers to this specific location;

class: Custom Type

The type of object is also called the category of the object, which is used to describe the internal representation of the object and the method operations it supports;

instance:instantiation:

That is to create an object of a specific type. After the instance is created, its identity and type cannot be changed. "Get the object type through type()". The object value of a mutable object can be modified, and the object value of an immutable object cannot be changed. The value cannot be modified;

Container: An object contains references to other objects

Data properties and methods:

Properties: (Variables) Values related to objects

Method: (function) The operation that will be performed on the object when called Function

(.): Use (.) to access properties and methods

Class instantiated into an object:

classA: instanceA: instanceB:

The above is the detailed content of What are the two programming methods in python language?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn