Python Basics 1-python Basic Concepts

Source: Internet
Author: User

The content of this section
    1. What kind of language is Python?
    2. Python main areas of application
    3. There are drawbacks to Python
1.Python is a kind of language

Python is an interpreted language

Compiled language interpretation: convert all the code into machine language at once, then write the executable file.

Explanatory language interpretation: Each execution of a program to the source program, there will be a shell program called the Interpreter (interpreter) to convert the source code into binary code for execution, in general, is to constantly explain, execute, interpret, execute.

compiled vs explanatory type

Compiled type
Pros: Compilers typically have pre-compiled procedures to optimize code. Because the compilation is done only once, the runtime does not need to compile, so the program execution of the compiled language is highly efficient . can run independently from the language environment .
Cons: After compilation, the entire module needs to be recompiled if modifications are required. When compiling the machine code according to the corresponding running environment, porting between different operating systems will be problematic, and you need to compile different executables according to the operating system environment you are running .

Explanatory type
Pros: With good platform compatibility, the interpreter (virtual machine) is installed and can be run in any environment. Flexible, Modify the code when the direct modification is possible , can be quickly deployed, without downtime maintenance.

Cons: Every time you run, you have to explain it again, performance is not as good as the compiled language .

Python is a dynamic type language

dynamic Type language: Dynamic type language refers to the language of data type checking during run time, that is, when programming in a dynamic type language, you never have to specify a data type for any variable, and the language will record the data type internally when you assign it to a variable for the first time.

static type language: The data type is checked during compilation, that is, the data type of all variables is declared when the program is written

Python is a strongly typed definition language

strongly typed definition language: a language that enforces the definition of a data type. In other words, once a variable is assigned a data type, it is always the data type if it is not cast.

weak type definition language: a language in which data types can be ignored. In contrast to strongly typed definition languages, a variable can assign values of different data types.

2.Python main application areas:

    • Cloud computing : The hottest language in cloud computing, typically using OpenStack.
    • Web Development : A number of excellent web frameworks, many large web sites are Python development, Youtube, Dropbox, watercress, know and so on. Typical web Frameworks are Django, Flask.
    • Scientific Computing, artificial intelligence : Typical library numpy, SciPy, Matplotlib, Enthought Librarys,pandas.
    • system Operation and maintenance: the necessary language for operation and maintenance personnel.
    • Finance : Quantitative trading, financial analysis, in the field of financial engineering, Python is not only used, but also used the most, and the importance of the year. Reason: As a dynamic language Python, the language structure is clear and simple, the library is rich, mature and stable, scientific calculation and statistical analysis are very suitable for use, production efficiency is much higher than c,c++,java, especially good at strategy backtesting.
    • graphical GUI: PyQT, Wxpython,tkinter.

3.Python the pros and cons

Advantages:

    1. Python's positioning is "elegant", "clear", "simple", so the Python program looks always easy to understand, beginners learn python, not only easy to get started, but also in the future, you can write those very very complex programs.
    2. Development efficiency is very high, Python has a very powerful third-party library, basically you want to achieve any function through the computer, the Python official library has the corresponding modules to support, directly download the call, on the basis of the base library to develop, greatly reduce the development cycle, to avoid repeating the wheel.
    3. High-level language ———— when you write programs in the Python language, you don't have to consider the underlying details such as how to manage the memory used by your program
    4. Portability ———— because of its open source nature, Python has been ported on many platforms (modified to make it work on different platforms). If you are careful to avoid using system-dependent features, all your Python programs can run on almost any system platform on the market without modification
    5. Scalability ———— If you need a piece of your critical code to run faster or you want some algorithms to be private, you can write some of your programs in C or C + + and then use them in your Python program.
    6. Embeddable ———— You can embed python into your C + + program to provide scripting functionality to your program users.

Disadvantages:

    1. Slow, Python run faster than the C language is really slow, compared to Java is also slower, but in fact, this refers to the slow running speed in most cases the user is not directly aware of, must rely on testing tools to reflect.
    2. Code can not be encrypted, because Python is an explanatory language, and its source code are stored in the form of a name, this is not necessarily a disadvantage, if your project requires the source codes must be encrypted, then you should not use Python in the beginning to implement.
    3. Threads do not take advantage of multi-CPU problems, which is one of the most common drawbacks of Python, the Gil, the Global Interpreter lock (interpreter lock), is a tool that the computer programming language interpreter uses to synchronize threads so that only one thread executes at any moment, The python thread is the native thread of the operating system. On Linux for Pthread, on Windows for win thread, the execution of threads is fully dispatched by the operating system. A Python interpreter process has a main thread and the execution thread for multiple user programs. Multi-threaded parallel execution is prohibited even on multicore CPU platforms due to the existence of the Gil.

Reference Link: http://www.cnblogs.com/alex3714/articles/5465198.html

Python Basics 1-python Basic Concepts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.