Python Tutorial 1: Introduction to Python

Python Tutorial 1: Introduction to Python

1. Python origin

The founder of Python is吉多·范罗苏姆Guido van Rossum
Insert image description here

1.1 Interpreter

The computer cannot directly understand any language other than machine language, so the program language written by the programmer must be translated into machine language before the computer can execute the program . Tools that translate other languages ​​into machine language are called compilers.

There are two ways the compiler translates: one is 编译, the other is 解释. The difference between the two ways is 翻译时间点不同. It is also called when the compiler is running in interpreted mode 解释器.
Insert image description here

  • Compiled language: Before the program is executed, a special compilation process is required to compile the program into a machine language file. There is no need to re-translate it when running, and the compiled result can be used directly. The program execution efficiency is high, it depends on the compiler, and its cross-platform performance is poor, such as C++.
  • Interpreted language: Programs written in interpreted languages ​​are not pre-compiled. The program code is stored in text form and the code is run directly sentence by sentence. When publishing a program, it seems that the compilation process is omitted, but when running the program, it must be interpreted before running.

Comparison between compiled languages ​​and interpreted languages:

  • 速度: Compiled languages ​​execute faster than interpreted languages
  • 跨平台性: Interpreted languages ​​are more cross-platform than compiled languages.

1.2 Python design goals

In 1999, Guido Van Rossum stated his goals for Python:

  • 一门简单直观的语言and as strong as the main competitors
  • 开源, so that anyone can contribute to it
  • code像纯英语那样容易理解
  • Suitable for 短期daily tasks of development

1.3 Python design philosophy

  1. grace
  2. clear
  3. Simple
  • The philosophy of Python developers is:用一种方法,最好是只有一种方法来做一件事
  • If faced with multiple choices, Python developers generally reject fancy syntax and choose明确没有或者很少有歧义的语法

2. Why choose Python?

Small amount of code.
The same problem is solved in different languages. There is still a lot of difference in the amount of code. Generally speaking , Pythonyes Java.1/5

3. Python features

  • Python is完全面向对象的语言
    • Functions, modules, numbers, and strings are all objects. Everything in Python is an object.
    • Full support for inheritance, overloading, and multiple inheritance
    • Supports overloaded operators and generic design
  • Python 拥有一个强大的标准库. The core of the Python language only contains common types and functions such as numbers, strings, lists, dictionaries, and files . The Python standard library provides additional functions such as system management, network communication, text processing, database interfaces, graphics systems, and XML processing. function.
  • It is provided by the Python community 大量的第三方模块and can be used in a similar way to the standard library. Their functions cover scientific computing, artificial intelligence, machine learning, web development, database interfaces, and graphics systems .

Object-oriented thinking

  • 面向对象It is a way of thinking and a programming technology
  • To solve complex problems, you can find multiple different objects, each performing their own duties, working together to achieve the final goal.

4. Python advantages and disadvantages

4.1 Advantages

  • Easy to learn
  • Free and open source
  • 面向对象
  • Rich library
  • Strong scalability

4.2 Disadvantages

  • Running speed
  • Domestic market is small
  • Lack of information in Chinese

Guess you like

Origin blog.csdn.net/WwLK123/article/details/131825611