Python language type

Source: Internet
Author: User

Python language type

Python is a strongly typed dynamic scripting language.

Strong type: adding different types is not allowed
Dynamic: Do not use the display data type declaration, and determine the type of a variable when it is assigned a value for the first time
Script Language: it is also an interpreted language. To run code, you only need one interpreter and do not need to compile it.

Strong and weak languages

1. Strong language: language that forces data type definition. Two variables of different types cannot operate on each other before forced type conversion is not performed. A strong type definition language is a type-safe language, such as Java, C #, and python. For example, "int I = 0.0;" in Java cannot be compiled;
2. Weak language: language in which data types can be ignored. In contrast to a strong language, a variable can assign values of different data types, allowing a piece of memory to be considered as multiple types, such as directly adding Integer Variables to character variables. C/C ++ and PHP are both weak languages. For example, in C ++, "int I = 0.0;" can be compiled and run.

Static and Dynamic Language

Static and Dynamic are for the Data Types of variables. The differences are as follows:

1. In code written in a static type language, the Data Type of the variable must be declared, and variables of different data types cannot be directly assigned values. The data type of the variable is checked during compilation.

2. Before using variables, the static language must allocate memory for them.

3. Static language has powerful functions, but is relatively difficult to learn and has poor flexibility.

4. The dynamic type language is the opposite of the static language. It checks the data type only during the running of the program, and does not need to specify the data type for the variable. When it first gives the variable to colleagues, record Data Types internally.

5. Although the dynamic type language is fast and flexible, it is difficult to find bugs before the code runs. Therefore, the development speed is improved, but the robustness of the program is lost.

1) Static language: c, c ++, c #, object-c, Java, etc.

2) Dynamic Language: Python, ruby, PHP, JavaScript, erlang, etc.

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.