Home > Article > Backend Development > Is Python a strongly typed language?
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.
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!