[Myths]The Python language is weakly typed

Last update on August 16, 2009 01:50 AM by fahd_zboot
Published by hyts78

[Myth] The Python language is weakly typed




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.)
Best answers for « The Python language is weakly typed » in :
Programming languages Show Programming language A "programming language" is a language designed to describe a set of consecutive actions to be executed by a computer. A programming language is therefore a practical way for us (humans) to give instructions to a...
[Pascal language] Recursion within a Bubble Sort Show [Pascal language] Recursion within a Bubble Sort Pascal is a stable, efficient and block-structured programming language. The "type" of variables used in Pascal language is made up of its semantic nature and its range of values, and can...
How to change the language on Facebook? ShowHow to change the language on Facebook? This tutorial will help you to change the language on Facebook if you never tried to do to is successfully: • Open facebook on your browser : http://www.facebook.com. • In the bottom left of...
How to access Google in your preferred language? ShowHow to access Google in your preferred language? Google is an American corporation with main activity as publishing advertising. To expand its numbers of users on a global scale, Google has extended as a multi-language website enabling you to surf...
Adjusting your websites to fit all types of resolution ShowAdjusting your websites to fit all types of resolution "How to adjust my site to the visitor's resolution and what resolution to choose?" Simply apply a relative width (= that changes with the size of the window and screen of the...
Download Addictive Typing Lessons ShowThe blind seizure with the cooperation of the ten fingers of the hand will not be any more a dream or a fantasy. Addictive Typing Lessons is an extension Firefox which will help you to gain knowledge of the blind seizure by using all your...
Download PF Auto-Typer ShowPF Auto-Typer is a simulation tool keypress. It is ideal for sending wrong message on instant messaging. The process is fully customizable: deadline, typing speed, pressure, on time and many more. Advantage You can also read a text file and copy...
Types of computers ShowTypes of computers There are several families of computers, depending on their format: Mainframes, computers which a great deal of computing power, enormous input-output capabilities and high level of reliability. Mainframes are used by large...
Types of networks ShowDifferent types of networks Different types of (private) networks are distinguished based on their size (in terms of the number of machines), their data transfer speed, and their reach. Private networks are networks that belong to a single...
Characteristics of programming languages ShowThere are many programming languages, each corresponding to specific needs (formula calculus, character string processing, real-time, etc.) with each having specific characteristics and functionalities. Therefore, the choice of programming language...