State of Python

State of Python

1 The State of Python Francisco Santos, Nuno Cerqueira, Ricardo Barreira, Rui Martins FEUP - Faculdade de Engenharia da Universidade do Porto Rua Dr. Roberto Frias, s/n, 4200-465 Porto, Portugal [email protected], [email protected], [email protected], [email protected] Abstract. In this article we describe the current state of the relatively recent Python programming language, which is an interpreted language with a simple syntax. Although often referred as a scripting language, it has a degree of functionality similar to the mainstream languages. Python’s philosophy is based on adaptability, flexibility and dynamism, supporting multiple programming paradigms. Some of the most useful and well known languages’ libraries and frame- works are then described. Among others, we present: SciPy, a library that offers useful scientific functions (e.g. Fast Fourier Transform); Tur- boGears, a framework that allows rapid front-to-back Web Development, including automatic mapping of databases; and wxPython, a framework to implement applications that use multi-platform native GUI widgets. In the end, we present a set of conclusions regarding the benefits of using Python as a general-purpose programming language. 1 Introduction Computer Science is a very recent subject. Despite that, it has suffered an ex- ceptional growth, since in just half a century1 it became the centre of the In- formation Society, having an immense number of daily-use applications. With a growth rate of this magnitude, it is normal that several branches appear in its development, as a reaction to the different types of people involved, as well as their different needs. Nowadays there are millions of developers all around the world, with a multi- tude of cultures, education and needs. This variety is mirrored in the existing pro- gramming languages. There are some mainstream programming languages (like Java, C++ and C#), used widely due to their enterprise nature or capabili- ties in certain key domains. However, in other tasks these languages are quite inefficient2 and are outperformed by languages of another kind. Python [16] is not a very well known language and it is not a mainstream one, although its features allow the same degree of functionality of these lan- guages, but frequently in an easier way (for programmers with the same degree of familiarity). 1 The first high-level programming languages were invented in the 1950s: COBOL, FORTRAN and Lisp. 2 In this case, the performance of a programming language is not given only by its computational efficiency, but also by its capabilities, programmer productivity. F. Santos, N. Cerqueira, R. Barreira, R. Martins 2 F. Santos, N. Cerqueira, R. Barreira, R. Martins With this article we intend to “spread the word” about Python, describing its current state. In this section (Sect. 1) we present the context on which Python is inserted, the goals and structure of this document. In The Python Programming Language (Sect. 2) we describe the language features, its philosophy, history and future. In Libraries (Sect. 3) we describe some important libraries that extend the language, adding usefulness and power to it. In Frameworks (Sect. 4), we describe some Python frameworks that allow to easily create domain specific applications. Finally, in Conclusions (Sect. 5) we present a small summary of Python’s current state and issue some comments on its usage and evolution. 2 The Python Programming Language 2.1 History Python is a relatively recent language. It was created in 1990 by Guido van Rossum at the CWI 3 in the Netherlands. Guido van Rossum was an experienced programmer and had been previously involved in the creation of the ABC programming language [5], also at the CWI. The lack of flexibility of ABC, along with his general dissatisfaction with other programming languages made him create Python. In its development he took advice and suggestions from several programmers, and a small Internet based community started to grow. After some problems with the licensing of the language, finally Python be- came completely Open Source. This event took place even before of the global establishment of the word Open Source. During this process, and due to the language’s features, the Python community had had an astounding growth as lots of people were contributing with very useful modules. The Python Software Foundation [14] was then created to satisfy the need for guidance that this evolution had created. This foundation is “(. ) a non-profit membership organization devoted to advancing open source technology related to the Python programming language”. One of its main purposes is to organize the PyCon – an annual conference where the state and evolution of Python is discussed, as well as the applications using it. Nowadays, pythoneers4 are very involved and actively developing applica- tions, frameworks and modules which contribute to the language’s growth. As a final remark, the name Python is often associated with snakes, which is wrong. As the author asserts frequently Python is really all about “spam, ham and eggs”, in a reference to Monty Python, the famous british comedian group. It is very common to see references to the series in Python’s code, tutorials and reference materials. 3 CWI stands for Centrum voor Wiskunde en Informatica, or National Research In- stitute for Mathematics and Computer Science. 4 A common name used for the members of the Python community. The State of Python 3 2.2 Philosophy Python is a high level dynamic programming language designed to ease the pro- grammer’s work, allowing him to spend most of the time with application prob- lems rather than dealing with the artifacts of the language. It also has some syntax constraints that force a more readable code, like rigid whitespace based indentation. It also aims to be an unambiguous language, meaning its code should be explicit about what it is doing, and also that there should be one, and only one, obvious way to do something. Python is a multi-paradigm language which means that the programmer has a wide range of paradigms to choose from when solving a problem, he could use object orientation, functional programming as well as aspect orientation or even design by contract. Another important goal of the language is its extensibility, integrating na- tively new C or C++ modules (as will be described in Sect. 2.5). 2.3 Language Features The Python programming language combines the most common features of mod- ern programming languages, like modules, classes, exceptions, high-level dynamic data types and dynamic typing. Modules permit a better code organization for large projects and also open the road for continuous expansion of the language by adding new libraries with new functionalities. Classes add the power of Object Oriented Programming (OOP), like in C++ or Java, giving more flexibility and easing changes to programs. OOP is consid- ered to be easier to learn by newcomers and it leads to a better direct analysis, coding, understanding of complex situations and procedures than other program- ming methods. Exceptions are a programming construct designed to handle runtime errors or other problems which occur during the execution of a computer program. They help the programmer to deal with unexpected situations that could be harder to spot otherwise. Also, because exceptions should be exceptional, the language doesn’t force the programmer to catch every single thrown exception as Java does. Should an exception occur, the language assumes that the application is better off by immediately exiting and printing the exception stack trace. Python supports the common high-level programming language data types: basic types like integers, decimals, characters and strings; collection types like lists, tuples and dictionaries; and object types that can be dynamically created as complex structures of other data types. Dynamic typing is a feature that permits a variable to change type during the execution of the program. It’s possible to start using a variable as an integer number and later use it as a string. Dynamic typing is a key language feature and one of the greatest causes for the reduction of code length in the application comparing to other static typed languages such as C++ or Java. 4 F. Santos, N. Cerqueira, R. Barreira, R. Martins 2.4 Python Versus Other Programming Languages It is not always easy to make a clear classification on how good a language is, when compared to others. Most of the comparisons available on the web are strongly biased because they’re written by “zealots”. Python has its own fair share of this. Like “VI versus Emacs”, “KDE versus Gnome” or “BSD versus Linux”, also Python has its own neverending debates titled “Python versus Perl”. Python, Perl and Ruby are similar when it comes to language power compar- ison. Some people might argue that language A has this feature which language B doesn’t, but in the end, they just have different ways of getting things done. Perl language emphasizes strings and regular expression manipulation, so it is expected that if you’re looking for these features, you’ll get you’re goals done easier by using Perl. This however doesn’t mean that it can’t be done in Python or Ruby. It simply is done in a different way. A common acceptance point is that Python code is easier to read than other languages. Because indentation is part of the language syntax, Python code generated in different projects always tends to look the same. This is undoubtedly a major maintainability asset for large projects and you can’t get this feature for free in other languages unless you impose well defined rules regarding the project’s code layout. It is also very usual to see Python compared to Java or C/C++ as far as performance is concerned.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us