Python, for easy programming

Python code must be indented
(Monty Python at work )
Python is an interpreted language widely used, one of the easiest to learn and use.
A day is enough to start programming with Python and you can write scripts in a few hours while you need for days with other languages. It has powerful features such as lists, tuples, dictionaries that allow you to translate your ideas into lines of code directly.
The lists are integrated and made it a successor to the Awk and any other word processor language.
There is a version for Windows, Linux and other platforms.
The name is a tribute to the comedy group "Monty Python", but the same name snake is still became the symbol of the language.
The creator of the language, Guido Van Rossum, was Google employee from 2005 to 2012 and works for Dropbox since.
Evolution
Designed on the base of the ABC language that was a model for simplifying a programming language (the variables for example retain their value from one session to another), Python is initially a very simple to read language.
But programmers never resist their evil demon that incites to write more and more convoluted and crytographic code, bringing the language to have an evolution in the complication that with the time make it approaching C++. The same function in the same language can become less and less comprehensible to the delight of the "genius programmer".
Features
- Python is an object oriented, interpreted language.
- Variables are dynamic, the type is not declared and may change.
- Indentation is used for block recognition and this is unic to Python.
- Tuples are variables or object packed all together, for functions' return, for example.
- Lists and dictionaries are other built-in composed objects.
- Functions may be embedded inside other functions.
- Can be extended with C modules.
Python 3.0 changes the syntax of the language which makes it partially incompatible with the previous ones.
- print x is replaced by print (x).
- Two types of string, data and str not compatible.
- Lists are replaced by views and iterators.
That is often blamed in the language:
- Code execution is slow. This is why it tends to be replaced by Go.
- You can not declare a variable like in JavaScript with var. This reduces clarity and security of the code.
- The object orientation is rather rustic and improvised.
- Using indentation to define a block is a design choice often contested. So if you comment a line, that changes the structure!
- Some builtin global functions should be object methods instead (but PHP is much worse in this regard).
Sample code
Displaying chars of a string.
s = "demo" for c in s: print c
Displaying elements of a list.
listdemo = [1,2,3] + [4,5]
subdemo = listdemo[1:3]
for num in subdemo:
print num
>>> should print: 2 3 4
We can make Python programs more easily with a free IDE like Eclipse for which numerous examples of use can be found on the Web, or if we are more involved, a commercial software like PyCharm.
Documents and tools
- Python
The official distribution with a complete tutorial. Thank to the installer to download, installation is very easy. - IPython
A free modern tool for interactive development, that won the 2012 Award from the FSF. A version is available for Linux, Windows and Mac. - Jython
A Java compatible version. Compile any Python source to bytecode, interpreted by the Java virtual machine. - Brython
To use Python in the browser instead of JavaScript. This is actually a pre-compiler that converts the Python language. There are already other implementations: Sculpt, Repl.it, Pyjaco, Pyjs, Empythoned. On the server-side, there is Oink. - Syntax of Python and PHP
All commandes compared.
