(Programming language + python + + variable names garbage collection) * knowledge

Programming language

Process from lower to higher development

1, machine language

The computer is based on the electrical work. (Based on the high, low 1,010,010,101,011)

If the performance of a machine language character meaning requires multi-segment code lines. But the computer to read fast.

So the machine language

Pros: fast enough to perform

Cons: Very low development efficiency

 

2, assembly language

Assembly language attributes, assembly language by English characters

Benefits: efficiency is slightly lower compared to machine language

Cons: Compared to machine language development efficiency is slightly higher

for example:

; Hello.asm sectionTop .data; data segment declaration msg db "Hello, world!" , 0xA; to the output string len equ $ - msg; wordlength section .text; declaration code segment Global _start; designated entry function _start :; string displayed on the screen mov edx, len; three parameters: string length mov ecx, msg; two parameters: the string to display mov ebx, 1; a parameter: the file descriptor (stdout) mov eax, 4; system call number (SYS_WRITE) int 0x80; call the kernel function ; exit the program mov ebx, 0; one parameter: the exit code mov eax, 1; system call number (sys_exit) int 0x80; calls the kernel function

 

3, high-level language

High-level languages, including: C, C ++, C #, java, php, python, go

Advantages: high development efficiency

Disadvantages: low efficiency

High-level language is divided into two types:

Compiled: Google Translation

C、C++、go

Interpreted: simultaneous interpretation

C #, python, java (explained after the first compilation)

 

Comparison of the properties of several programming languages

1, development efficiency:

(Interpreted> Compiled)> Assembly language> machine language

2, efficiency:

(Interpreted <Compiled) <assembly language <machine language

3, the efficiency of cross-platform:

Speed ​​of the number of rows interpreted> compiled (different system) like the efficiency of reading the code

4, the learning curve

Machine Language> Assembly language> high-level language

 

 

python related knowledge

python interpreter

IT industry's Law: Do not download the latest version, so do not be under the latest python3.8 (the latest version), the result of experience, a lot of problems.

python version Classification

python2.x

python3.x

python code execution in two ways:

1. Interactive: reciprocal

2, the command line: python file extension convention will be defined as .py

In fact, that is simply a text file .py

python language heard is glue (glue language).

glue is a glue in English, it is bonded to the action effect, where can be affixed on the meaning.

Authoring tools python code

pycharm is designed to IDE tool written in python.

IDE (Integrated Development Environment) is an integrated development environment abbreviation. IDE is a programming software, is the integration of some basic tools programmer language will be required, application software basic environmental and other auxiliary functions.

 

Some knowledge of the operation point code

Comment:

Single-line comments: ctrl +?

#

Multiline comments:

" " "

" " "

 

Knowledge variable name

The amount of change in the state described

Importance: no variables can not.

 

1, how to use variables?

Part of variables

1, the variable name

2, assignment symbol

3, variable values

2, variable names naming convention:

1, only letters, numbers, underscores

2, can not use Chinese (some rules of the company's class)

3, can not start with a number

4, to distinguish between sensitive

 

3, variable names naming style:

First, the hump body

UserAge = 18

print(UserAge)

Second, underscore body

user_age = 18

print (user_age) with more body underlined that this mode

 

4, three variable characteristics:

Value: value

Memory Address: id

Types of variables: type

 

constant:

There is not constant in python

NAME = "SEAN"

HOST = "127.0.0.1"

python programmers all uppercase letters convention of variables defined as constants

 

Memory management:

Small integer pool:

 

a = 255

b = 255

print(id(a))

1838517664

print(id(b))

1838517664

 

This knowledge is this: if the inner 0-256, a small assignment 256, 256 small b assignment, then

Small a small b and address is the same, which is a mechanism for saving a space-saving python of the python.

 

Garbage collection

As the name suggests garbage collection mechanism is triggered certain conditions python recovered inside the garbage.

Mainly how to use?

What use rules? How to use this mean?

a = 10

a = 11

First assigned to 10 a, and then is assigned to 11 a, 10 the first start address assignment is still, so that garbage like this, python will automatically help you recover.

10 is not referenced, so to say that all references number is the number 0, it is automatically deleted.

 

Guess you like

Origin www.cnblogs.com/medigrat/p/11779205.html