Python, for easier programming

Python code must be indicated
(Monty Python at work)
One day is enough to start programming with Python and you can write scripts in a few hours that require days with other languages. It is a widely used and portable language.
It has powerful functions such as lists, tuples, dictionaries, which makes it very easy to translate ideas into lines of code.
These integrated lists make it the successor to Awk and any other word processing language.
The origin of the name is a tribute to the humorous group "Monty Python," but the snake of the same name still became a symbol of the language .
Language author Guido van Rossum worked at Google from 2005 to 2012 and has been at Dropbox ever since. However, Dropbox converted most of its programming to Go in 2014, which is the current trend in web services.
Evolution
Developed from the ABC language, which was a model when simplifying the programming language (variables even retained their value from session to session), Python was initially a very easy-to-read language.
But programmers never resist their evil daemon for long, which encourages them to write increasingly intricate and cryographic code, leading the language to evolve in a complication that brings it closer to the C++ language over time. The same function in one language may become less and less understandable, to the delight of the "expert."
Despite appearing in 2008, Python 3 is still less used in 2016 than in Python 2. Incompatibility with previous versions without performance improvement prevents migration. The fear that existing libraries will be incompatible, which is often the case, also slows down its acceptance.
That is why an unofficial version of the interpreter, Thauton, appeared, which brings Python 2 new features introduced in 3 as async/awais, for example.
Several projects are designed to speed up Python by compiling it in C using CPython, or using a virtual machine with Jython. The Unladen Swallow project to run Python on LLVM was abandoned due to technical obstacles, including the inability to be compatible with libraries in C.
In fact, Python, as a corporate language, has reached a dead end: the standard interpreter is not intended for the modern multi-core processor environment. It's too slow. Alternative implementations can be used, one of which uses JIT. But in this case, compatibility with extensions and libraries, which are actually the first reason for choosing this language, is lost.
Dynamic scenario
This scripting language can be used on the server or as an application language.
- This is an initially interpreted language, but there are compilers and a port for JVM and .NET.
- It is object-oriented.
- Variables are dynamic, the type is not declared and can change.
- Indents are used to recognize the block, this is typical only of Python.
- Tuples are variables or objects packed together, for example, to return functions.
- Lists and dictation are other built-in compound objects.
- Items can be nested.
- Can be extended with C modules.
Python 3.0 changes the syntax of the language, making it partially incompatible with previous versions, to the point that it is considered a slightly new language among older users.
- print x is replaced by print (x).
- the range becomes an object, not a list of values.
- End of byte string support, all unique.
- Operator <> is deleted.
- dict.keys returns a view, not a list.
What is often criticized language, regardless of version:
- Code execution is slow. Therefore, it is usually replaced with Go.
- Variable cannot be declared as in JavaScript with var. This deprives the code of clarity and security.
- The orientation of the objects is quite rustic and improvised.
- Using indentation to define a block is often a controversial design choice. Thus, if you comment on one line, it changes the structure!
- Some pre-installed global functions should be rather object methods (but PHP is much worse in this regard).
You can compare the syntax of Python, Ruby, PHP to better judge readability.
Code examples
Show word letters:
s = "demo"
for c in s:
print c
Show list items:
listdemo = [1,2,3] + [4,5]
subdemo = listdemo[1:3]
for num in subdemo:
print num
Should show: 2 3 4...
Wil... else
Adding else to the while control structure is unique to Python. Let's look at an example:
while x < 10 :
x = x + 1
else:
print("x = 10")
The else clause is included when the while condition is no longer true, so once x is worth 10.
It will be said that this provision is a little superfluous, because this is always the case when you leave the loop, but, nevertheless, there is an excuse for this syntax:
while x < 10:
x = x + 1
if mytaylor == rich: break
else:
print("x = 10")
It can be seen that you can exit the loop regardless of the x value, and the else clause is not always included. It depends only on the value of x.
It remains that exiting the loop regardless of state is an interrupt in program logic.
Toolbox
Python programs are easier to implement with free EDI like Eclipse, for which you can find many examples of use on the Web, or, if you are more involved, commercial software like PyCharm.
Here is a list of the main tools for writing Python scripts:
- Python.org
Official distribution with a complete textbook. Thanks to the setup program you need to download, the installation is easy. - Tauton
Unofficial version compatible with Python 2.7, but with Python 3 capabilities. - PyCharm from JetBrains .
A specialized IDE exists in the free and open source version. - Nuit
Python compiler for full language. - IPython
A free and modern interactive development tool that won the 2012 FSF Award. There is a version for Linux, Windows and Mac. - Jython
Java compatible version. Compiles a Python source into bytecode interpreted by a Java virtual machine. However, they are limited to older versions of the language .
There is also a compiler for .NET, IronPython. - There are several implementations for using Python in a browser instead of JavaScript: Brython, Sculpt, Pyjaco, Pyjs, Empythoned. We have Oink. Pythonium also converts Python to JS .