Is Python a strongly typed language?

anonymity
Release: 2019-06-15 09:52:39
Original
3976 people have browsed it

Strength and weakness are relative to types.

Strong type, after you have a value, the type of the value is determined. For example, n='1', the type of n is determined (string), so you cannot do n in Python ='3' m=n 1 operation. This is not the case with weak types. The value type can be determined when needed. For example, in PHP you can $n='3'; $m=$n 1, and '3' can be treated as an integer during operation. type to perform calculations.

Weak types are more flexible to use, but sometimes this flexibility can lead to some ambiguities. In comparison, strong types are more rigorous.

Is Python a strongly typed language?

Python is a strongly typed dynamic scripting language

Many people have misunderstandings about whether Python is a strong language type or a weak language type. In fact, whether it is a strong language type Type languages ​​only need one sentence to identify,

Strong typing: the addition of different types is not allowed. For example: an integer string will report a type error.

Dynamic: No explicit data type declaration is used, and the type of a variable is determined when it is assigned a value for the first time.

Script language: Generally an interpreted language, only an interpreter is needed to run the code and no editing is required.

The above is the detailed content of Is Python a strongly typed language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template