Myths - The Python language is weakly typed

March 2017




Myth


The programming language Python is weakly typed, like PHP or Basic.

Reality


FALSE.

Explanations

Python is a language with dynamic typing.


Python is a high-level programming language whose asset is code readability
Though its syntax is easy to use, it is very powerful and can be use for all purposes and its standard library is large and comprehensive. It make use of indentation as block delimiters( an unusual method among popular programming languages).

Python provide a platform supporting multiple programming paradigms (primarily object oriented, imperative, and functional) and consists of a fully dynamic type system and automatic memory management, similar to Perl and is often used as a scripting language.

Demonstration


>>> a="toto"
>>> b=5
>>> print a+b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects
>>>


Python made it clear that you can not concatenate a string and an integer.
If the Python was a weak typed language, he displayed "toto5.

(PHP is a language for low dynamic typing, the C + + and Java languages are strong static typing.)

Related


Published by hyts78.
This document, titled "Myths - The Python language is weakly typed," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).