BlackFlame33

BlackFlame33

若无力驾驭,自由便是负担。个人博客 https://blackflame33.cn/

Python Study Notes-01

History and Features of the Python Programming Language

1. Introduction to Python#

Python is an object-oriented, interpreted computer programming language. Python syntax is concise and clear. It uses text indentation to represent code blocks instead of using braces like most other languages. This enforced indentation forces programmers to pay constant attention to code formatting, resulting in clear and elegant code structure.

# Print Hello World
print("Hello, world!") # Yes, one line, just one line

2. Python Features#

2.1. Glue Language#

Python can easily connect various modules made in other languages. For example, you can quickly develop a program using Python and then rewrite specific parts in a more suitable language.

2.2. High-level Language#

Python is a "high-level" programming language. This high-level does not refer to performance or superiority, but rather to its semantic closeness to human language, making it easier to understand.

2.3. Rapid Development with Frameworks#

Python has numerous frameworks available for developing large-scale applications. For example, web development with Django.

2.4. Drawbacks#

Python, being an interpreted language (even if it can be compiled, it is "just-in-time compilation"), is compiled into bytecode. This may result in slightly poorer performance compared to other languages.

3. Cornerstone Concepts#

3.1. Programming Language#

Humans cannot solve problems quickly and efficiently, but computers can. However, humans and computers cannot understand each other. For example, different species cannot communicate directly due to the lack of a common language. To solve this problem, one party needs to compromise and accommodate the other. In the early days of programming, programmers accommodated computers, but machine language was too cumbersome and too close to the hardware, causing great pain for programmers. To alleviate this situation, programmers abstracted the meaning represented by machine language, making it closer to human language, and thus computer programming languages were born.

Evolutionary process: Machine Language -> Assembly Language (low-level language) -> Programming Language (high-level language)

3.2. Compiler#

A program that translates assembly or high-level computer language source code into equivalent machine code.

3.3. Interpreter#

An interpreter can directly translate and execute high-level programming languages line by line. The interpreter does not translate the entire program at once. It acts as an "intermediary" and translates into another language each time the program is run. Therefore, the interpreter's program execution speed is relatively slow.

Difference between compiler and interpreter: Translation and simultaneous interpretation - Translation involves translating prepared materials into the target language. Simultaneous interpretation involves translating each sentence into the target language in real-time.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.