1. About Python language
The Python programming language was created in 1990 by Guido van Rossum. The name Python comes from a tribute to the television series Monty Python’s Flying Circus of which G. van Rossum is a fan. The first public version of this language was released in 1991.
The latest version of Python is version 3. Specifically, version 3.11 was released in 2022-10-24. Python version 2 is now deprecated and will cease to be supported after January 1, 2020. If possible avoid use it.
The Python Software Foundation is the association that organizes the development of Python and animates the community of developers and users.
Designed to be object-oriented, it has no less tools to engage in functional or imperative programming; it is also one of the reasons that earned him its name of “agile language”.
Other reasons include the speed of development (quality of interpreted languages), the large number of modules provided in the base distribution, and the number of interfaces available with libraries written in C, C ++ or Fortran. It is also appreciated for the clarity of its syntax, which opposes it to the Perl language.
The Python language is under a free license close to the BSD license and works on most computer platforms, from supercomputers to mainframes, from Windows to Unix including GNU / Linux via macOS, or Android, iOS , and also with Java or .NET. It is designed to optimize programmers’ productivity by providing high-level tools and easy-to-use syntax.
It is also appreciated by some teachers who find a language where the syntax, clearly separated from the low-level mechanisms, allows an easy introduction to the basic concepts of programming.
2. Python language features
Let’s detail some of the main features of Python, more specifically, the language and its two current implementations:
- Python is portable, not only on the different variants of Unix, but also on proprietary OS: MacOS, BeOS, NeXTStep, MS-DOS and different Windows variants. A new compiler, called JPython, is written in Java and generates Java bytecode.
- Python is free, but it can be used without restriction in commercial projects.
- Python is suitable for scripts of about ten lines as well as complex projects of tens of thousands of lines.
- The syntax of Python is very simple and, combined with advanced data types (lists, dictionaries, …), leads to programs that are both very compact and very readable. Equal features, a Python program (extensively commented and presented according to the standard canons) is often 3 to 5 times shorter than a program C or C ++ (or even Java) equivalent, which generally represents a development time of 5 to 10 times shorter and a greatly increased ease of maintenance.
- Python manages its resources (memory, file descriptors …) without the intervention of the programmer, by a mechanism of counting of references (close, but different, of a garbage collector).
- There are no explicit pointers in Python.
- Python is (optionally) multi-threaded.
- Python is object-oriented. It supports multiple inheritance and operator overload. In its object model, and using the terminology of C ++, all the methods are virtual.
- Python integrates, like Java or the recent versions of C ++, a system of exceptions, which makes it possible to simplify the management of the errors considerably.
- Python is dynamic (the interpreter can evaluate strings representing expressions or Python instructions), orthogonal (a small number of concepts is sufficient to generate very rich constructions), reflective (it supports metaprogramming, for example the capacity for an object to add or remove attributes or methods, or even to change class running) and introspective (a large number of development tools, such as the debugger or the profiler, are implemented in Python himself).
- Like Scheme or SmallTalk, Python is dynamically typed. Any object that can be manipulated by the programmer has a well-defined type at runtime, which does not need to be declared in advance.
- Python currently has two implementations. One, interpreted, in which the Python programs are compiled in portable instructions, then executed by a virtual machine (as for Java, with one important difference: Java being statically typed, it is much easier to speed up the execution of ‘a Java program than a Python program). The other generates Java bytecode directly.
- Python is extensible: like Tcl or Guile, it can be easily interfaced with existing C libraries. It can also be used as an extension language for complex software systems.
- The standard Python library, and the contributed packages, give access to a wide variety of services: strings and regular expressions, standard UNIX services (files, pipes, signals, sockets, threads …), Internet protocols (Web, News, FTP, CGI, HTML …), persistence and databases, graphical interfaces.
- Python is a language that continues to evolve, supported by a community of enthusiastic and responsible users, most of whom are supporters of free software. Parallel to the main interpreter, written in C and maintained by the creator of the language, a second interpreter, written in Java, is under development.
- Finally, Python is a language of choice for processing XML.
3. Graphical Interfaces
Python has several modules available for creating software with a graphical interface. The most common is Tkinter. This module is suitable for many applications and can be considered sufficient in most cases. However, other modules have been created to be able to bind Python to other software libraries (“toolkit”), for more features, for better integration with the operating system used, or simply to be able to use Python with it. favorite library. Indeed, some programmers find the use of Tkinter more painful than other libraries. These other modules are not part of the standard library and must therefore be obtained separately.
The main modules giving access to GUI libraries are Tkinter and Pmw (Python megawidgets) 43 for Tk, wxPython for wxWidgets, PyGTK for GTK +, PyQt and PySide for Qt, and finally FxPy for the FOX Toolkit. There is also an adaptation of the SDL library: Pygame, a binding of SFML: PySFML, as well as a library written specifically for Python: Pyglet (en).
It is also possible to create Silverlight applications in Python on the IronPython platform.
4. Use of the python language
As mentioned above, Python lends itself to a lot of tasks. The basic distribution allows, among other things, network developments, the creation of graphical interfaces (via tcl / tk), cgi programming, XML processing, etc … Its relative ease of interfacing with written libraries in other languages it is a tool of choice for scientific computing applications. It is also increasingly used as a prototyping language.
Python is also notable for the number of libraries accessible through the installation of the appropriate modules. Be it the connection with a database, the use of GUI libraries (wxPython, PyQt, pyGTK), the advanced XML manipulation (pyXML), the image processing (Python Imaging Library), the development video game (pygame), OpenGL, the vast majority of current technologies has its python extension
5. Language implementations
In addition to the reference version, named CPython (because written in C language), there are other systems implementing the Python language:
- Stackless Python, a version of CPython that does not use the C language call stack;
- Jython, a Python interpreter for Java virtual machine. It has access to the libraries provided with the Java development environment;
- IronPython, an interpreter / compiler (experimental) for .Net / Mono platform;
- Brython, a Python implementation for web browsers.
- PyPy a Python interpreter written in a subset of Python compilable to C or LLVM;
- Shed Skin, a compiler of a subset of Python producing C ++ code;
- Unladen Swallow, a version of CPython optimized and based on LLVM, now discontinued.
These other versions do not necessarily benefit from the entire library of functions written in C for the reference version, nor the latest developments in the language.