10 basic knowledge points of Python, novices must memorize

  • Wechat

10 basic knowledge points of Python, novices must memorize

Programmer programming sharing2019-08-28 16:23:20

10 basic knowledge points of Python, novices must memorize

 

Python is an object-oriented, interpreted interactive high-level scripting language: Python is designed to be a highly readable language because it uses a large number of English words as keywords, and unlike other languages ​​that use punctuation. Complicated grammatical structure, Python has very few grammatical structures.

Follow, forward

Many people learn python and don't know where to start.
Many people learn python and after mastering the basic grammar, they don't know where to find cases to get started.
Many people who have done case studies do not know how to learn more advanced knowledge.
So for these three types of people, I will provide you with a good learning platform, free to receive video tutorials, e-books, and the source code of the course!
QQ group: 721195303

10 basic knowledge points of Python, novices must memorize

 

Python is an object-oriented language: that is, Python supports object-oriented and supports code encapsulation in objects.

Python is an interpreted language: that is, the Python program is interpreted and executed by the interpreter at runtime, so there is no need to compile the source program in advance. This is similar to Perl and PHP.

Python is an interactive language: that is, you can write your programs interactively directly at the Python prompt.

Python is a language for beginners : Python is a language very suitable for beginners. It supports the development of many types of applications, such as simple text processing, www browser application development, game development, and so on.

1) What is Python? What are the advantages of using Python? What are the disadvantages?

Python is an object-oriented explanatory interactive language with mechanisms for automatic management of objects, modules, threads, exceptions and memory.

The advantages of using Python are: simple, easy to learn, portable, extensible, readable, has a variety of built-in data types, open source, and so on.

The disadvantages of using Python are: slow running speed, the code cannot be encrypted (interpreted language, only the source code can be released when publishing a python application, unlike the C release of compiled application files)

2) What is PEP 8?

PEP 8 is a coding standard, a series of coding suggestions on how to make Python code more readable.

3) What is serialization (pickling) and deserialization (unpickling)?

Serialization: The process of converting variables in memory into storage or transmission. Application JSON transmission, serialized to a unified format json

Deserialization: the opposite of the serialization process

The Pickle module allows us to convert a Python object into information represented by a string, and save it to a file using the dump function. This process is called serialization. The process of reconstructing Python objects using the object information stored in the file is called deserialization.

4) How is Python interpreted and executed?

Python is an interpreted language that can run programs directly from the source code. The source code written by the programmer is first converted into an intermediate language code, and then converted into machine language code that can be directly executed.

5) How does Python manage memory?

Python memory space is managed in the form of Python private heap. All Python objects and data structures are stored in a private heap. The interpreter can access the private heap, but the programmer cannot.

The work of allocating memory in the Python heap space to Python objects is done by the Python memory manager. The kernel API will provide programmers with some related tools to complete the coding work involving memory.

Python also has a built-in garbage collector to recycle and release memory to the heap space.

6) What tools can be used to find bugs in the program for static analysis?

PyChecker is a static analysis tool that can find bugs in Python source code and warn about the style and complexity of the code. Another tool is Pylint, which can verify whether a module meets coding standards.

7) What is a Python decorator?

It is used to decorate a function so that the function dynamically generates additional functions without modifying its own function definition; the input parameter of the decorated function is the function that needs to be decorated. The decorator is essentially a higher-order function that returns a function

A Python decorator is a specific modification that we can conveniently make to the function while conforming to the Python syntax.

8) What is the difference between list, tuple, set and dictionary?

List: Variable elements (any data type), ordered (indexable), append/insert/pop;

Tuple: The element is immutable, but the variable element in the element is variable; ordered (indexable); and the tuple can be hashed, for example, as a dictionary key.

Collection: unordered (not to be indexed), mutually different

Dictionary: unordered, key-value pairs (key: value), the key is unique and cannot be repeated

9) How to understand dictionaries and lists?

They are a grammatical structure, data container used to create mutable objects.

The dic insertion and search speed is faster than the list, and will not increase with the increase of the key, but the list will increase with the increase of the element (offset)

10) How are parameters passed by value or by reference?

In Python, it should be the "pass by object reference" method, which is passed by reference. Everything is an object, and the parameters are all references

If the function receives a reference to a mutable object (such as a list, dictionary), the original value of the object can be modified == is equivalent to the "pass by reference" method;

If the function receives an immutable object (such as numbers, characters, tuples), you cannot directly modify the value pointed to by the original object == equivalent to the "value transfer" method;

I still want to recommend the Python learning group I built by myself : 721195303. All students in the group are learning Python. If you want to learn or are learning Python, you are welcome to join. Everyone is a software development party and shares dry goods from time to time (only Python software development related), including a copy of the latest Python advanced materials and zero-based teaching compiled by myself in 2021. Welcome friends who are in advanced and interested in Python to join!

Guess you like

Origin blog.csdn.net/aaahtml/article/details/114160699