Python is one of the most popular programming languages. In fact PYPL has Python as now the most popular language, and Tiobe recently awarded Python language of the year. So clearly Python has very strong appeal, hence the upgrade from ‘good’ to ‘great’ in the title of this post. An interesting perspective can be gained from the words from Tiobe January 2019 in awarding Python language of the year:
The Python programming language has won the title “programming language of the year”! Python has received this title because it has gained most ranking points in 2018 if compared to all other languages. The Python language has won 3.62%, followed by Visual Basic .NET and Java. Python has now definitely become part of the big programming languages. For almost 20 years, C, C++ and Java are consistently in the top 3, far ahead of the rest of the pack. Python is joining these 3 languages now.
Note that Python has joined the previously established top languages, and given Python is a language with origins in the early 1990s, this has taken a long time. It turns out that each of Python, C/C++ and Java has different strenghts that make them applicable to each of three types of programming, and that the type of programming where Python leads is on the rise. So where are each of these three languages strongest and weakest? This post examines specifically Python in contrast to other languages, the general differences and how these differences impact suitability for different applications.
- Compiled vs Interpreted Languages
- Python: New King of the Scripting Languages
- Domains of Scripting vs Compiled Languages
- Python Observations: From The Great to the Ugly by Strength
- The Great: Python Key Strength
- The Ugly: When Python is not the answer
- Great vs Ugly By Application:
- Application Popularity background
Compiled vs Interpreted Languages
Python: New King of the Scripting Languages
Quoting from another language popularity measure, PYPL:
Python grew the most in the last 5 years (16.2%) and PHP lost the most (-5.6%)pypl http://pypl.github.io/PYPL.html
The key point here is that Python has been the strongest growing language, and it has grown significantly while other interpreted or ‘scripting’ languages have declined. This article from Jaxcentre suggests Python is jut and exception, and scripting languages are on the decline because as such languages are a poor choice for large scale projects.
The ascendancy of Python masks a serious question: where are all the other scripting languages? According to the TIOBE Index for November 2017, other dynamically typed languages like Perl, PHP, and Ruby may be on a gentle decline.https://jaxenter.com/tiobe-index-scripting-languages-138905.html
The data is well collated, but I draw a slightly different conclusion. Firstly, while it is true that virtually all scripting languages other than Python are on the decline, I suggest that this is more about Python dominating the segment than the segment declining. Jaxcenter focuses on predominantly on application domains where, as outlined below, interpreted/scripting languages are less suitable than compiled languages. But there are domains where the reverse is true, and interpreted/compiled languages are ideally suited. In fact these domains are growth areas, which results in Python growing by a greater amount than the other scripting languages are dropping. What we are seeing in my view, is that the interpreted/scripting language domain is now quite mature, and is consolidating around Python.
Domains of Scripting vs Compiled Languages
From the invention of Basic in 1964, there have been domains where interpreted languages were an optimal solution. The greatest strengths have always been in simple programs, both for beginners learning to program and simple programs that can be described as scripts. The domains for programs can be thought of as:
- programs to be run by the programmer (including learning to program)
- applications written to be run by ‘end users’ (includes mobile and desktop apps)
- system programs (includes operating systems, compilers, device drivers etc)
- web servers
- web front end (in browser programs)
Python dominates domain 1 and is a strong player in domain 4, but is virtually absent in the other domains. The Jaxcenter article on scripting languages quotes Tiobe and suggests:
Most errors in scripting languages occur run-time. They show up when a program is run. Despite the fact that one can write all kind of unit tests to compensate for this, it remains quite dangerous because such errors might happen while running the application in production. Since quality demands are getting higher and higher, hardly anybody dares to write a critical and large software system in a scripting language nowadays.jaxcenter quoting Tiobe
Like many quotes, there is clearly some support for this point as outside of web application, it is very difficult to find a large system written in Python or another ‘scripting’ language. But there are large web applications writing in scripting languages. Why? These points are to be explored.
Python Observations: From The ‘Great’ to The ‘Ugly’
The Great: Python key Strength
Python: Unmatched simplicity to start a project combined with highly readable code
Python combines an unsurpassed ease of creating programs, together with highly readable source code based on unique source code formatting using significant white space. The ‘great’ result is that building a program with Python is as easy as it can get. How easy it is to start a project, is of increasing importance with the rise of agile methodology where getting something running as quickly as possible is a key strategy.
The Ease of Starting a Project in Python
Creating a program in Python is less work than with any of the leading leading alternatives. ‘Hello World’ samples with other languages may look effectively just as simple as with Python, but Java, C/C++ or Kotlin all require not just the equivalent ‘hello world’ program snippet, they also require a build process that requires build instructions, and usually a separate folder for the project. In fact, perhaps even a tree of folders can be required to start a project. Tools can create the folders and even the build automatically, hiding the additional complexity at first, but the complexity must then be maintained, increasing the workload.
The Interpreter Advantages: No Build, Reusable Environment based Dependencies
Like other interpreted languages such as Ruby, with Python the build process can be hidden. The developer builds up the environment on their development computer, and each new project can run in that same built environment with no additional overhead. As the environment builds incrementally, there is no noticeable step and each new project can inherit the built environment.
Opinions can be mixed on the value of the significant whitespace as used in Python, but the use of whitespace delivers a clean, simple, and highly readable syntax. The features of Python, perhaps the combination of readability and simplicity together with still being able to code complex problems, has been sufficient to see Python gain a sufficient lead in popularity over other interpreted languages such as Ruby, that it would now take a significant breakthrough for another rival language to ever overtake Python as King of the interpreted languages. In other words, it will takes something new or something newly changed to rival Python as King of the Interpreted languages.
The Ugly: when is Python is not the answer
The Special Need for Speed: Native Code.
There is a lot of distracting discussion about the speed of different languages. For almost all applications, the speed is determined not by the code of the language, but by how the language calls library functions, operating system calls and performs input/output. In all these respects, Python holds its own in terms of speed, which means for almost all uses, the speed of Python programs is comparable with that of other leading languages. However, if you want to write a language compiler, or an operating system, or critical library functions, or device drivers, then another type of speed is required and the only answer is a language which compiles to native code. If you do are writing a compiler or operating system etc, then Python is out, languages that run on virtual machine or a JVM are also out of the question and a language such as C/C++, Kotlin Native, Swift, Go or Rust is the only solution. This only applies for a very specific domain, but it is a domain where Python does cannot compete, C/C++ dominates and up until recently, C/C++ was unchallenged.
Distributed Applications: Compiled Languages (Native + JVM)
Python programs are simple to distribute as Python files, but distributing packaged programs requires a build, turning a key python advantage for other uses into a hindrance.
Distribution as source is unworkable for many uses this reveals the source code, allows changes by the user, and requires the user also installing Python and required libraries.
The combination is problematic if you do not wish to reveal the source code or allow the program to be altered. While you can package Python programs to act as self contained applications, the fact that this is rarely done with Python means up until recent peed is in almost all cases determined by how , and their is no evidence and can run wican a program, from Of these top lnreal has no rival that combinesConsider the major Software Types/Lifecycles.
Great Vs Ugly by Application
Application Popularity background
Applications can be mapped to the 5 domains described on this page, or at least combinations of those 5 domains.
On the Tiobe page describing Python as language of the year 2018 and entering the top tier of languages with Java and C/C++, specific areas where Python reigns are listed:
Python is joining these 3 languages now. It is the most frequently taught first language at universities nowadays, it is number one in the statistical domain, number one in AI programming, number one in scripting and number one in writing system tests. Besides this, Python is also leading in web programming and scientific computing (just to name some other domains). In summary, Python is everywhere.Tiobe Program Language Index: January 2019
The words “Python is everywhere” is a slight exaggeration, as very few mobile apps, and no operating systems are written in Python. In fact, in the significant domain 2 and domain 3 (Applications to be run by end users and Systems programs), Python is basically absent, which is why Python is ‘one of the top tier’ as opposed to the only top tier language. The applications where Python is noted as a ‘number one’ are: Learning to Program, statistics, AI programming, scripting, writing system tests, with also a role in ‘leading’ in web programming, and scientific programming.
Universities and Learning Programming
When learning to program, the examples coded tend to be small in size, no longer in use after once they are judged to be complete, and most importantly, are run only by the author or a dedicated test system. This sits perfectly in the domain where python is king. There are reasons to learn other languages, such as ‘C’ to learn how things work inside a computer or a compiled language to learn the specifics of compiled languages, but for the vast bulk of learning to code, Python is ideal. The history of Python suggests teaching was in the genes of Python from the outset.
While there are packages for statistics to be run only by end users, and these are typically not written in Python, the vast bulk of statistics programs is programs written to be run by person analysing the data. Domain 1, the programmer runs the program, and the key area where Python leads.
AI Progamming in Python
Is Python a clear number 1 in AI programming? Articles will suggest their are several choices, and generally, Python is the only scripting/interpreted language listed. The choice between compiled and interpreted/scripted is a choice between Python and a variety of compiled languages. This likely makes Python the number 1 language, even if the bulk of AI code is actually written in a variety of other languages. Not all AI code should be written in an interpreted language, but when an interpreted language is viablbe, then Python is the only choice to consider.
Python for Scripting
Python is king of the ‘scripting’ languages, so surely this is a simple choice. Strangley, there are specific scripting situations, such as ‘gradle scripts’ where Python is not an optimal choice. It could even be in future that scripitng with compiled languages such as Koltin (.kts files) could become a real contender for general purpose scripts, but generally, that time has not yet arrived, and Python is number 1 for general purpose scripts.
Writing System Tests in Python
I must admit that I am unsure where Tiobe gained this insight, but system tests are example of scripting code run by the developer, so it does make sense that Python would be the leader. Note that unit tests tend to be written in the same language as the code, so unit tests are not really a separate application to be measured.
Web Programming in Python
A web backend breaks the rules of most programs. Devlopers/support people set up and run the server, and end users can interact with the system without ever starting or ‘running’ the program or dealing with the user interface for the program. The smaller the web service, the less the development team also deals in other applications, the more likely the web programming will be written in Python. Python is ‘a leader’, but not necessarily ‘the leader’. We have web programs currently written in Python. As they scale, we expect to migrate the code, but Python is a great way to start and many very large scale projects either started in Python or still have at least some code in Python.
Scientific Computing in Python.
Once again, the author of the program will run the program is the case for the vase bulk of code written as scientific programming. Conversly, programs written with scientific researches as end users are less likley to be written in python, but think of how many more programmers repreented by the scientific community at large as opposed to pure software developers writing code. I once attended a talk by an astronomer, and he stated the skill he needed most in his field was coding. Coding is becomming a companion skill in many scientific careers, and the bust language for that companion skill is Python.
Python is king of the interpreted/scripting languages, and the domains where such a language is the best solution are expanding. Increasing domination of areas that themselves are expanding produces a rapidly growing language. However there are key areas of computer where Python is not really an option, such as mobile App, and system programming, together with other areas, such as desktop Apps, web front ends etc where Python use is neither growing nor optimal.
Python is a key language, and perhaps one of the most essential for any developer to learn. This leaves the question of “what language should I learn in addition to Python, so I can tackle the signifcant areas with Python is not the best choice.”
1 thought on “Python: The great, the bad and the ugly”
[…] in a perfectly adequate programming language in python, would need to learn kotlin? There are use cases where Python is virtually unmatched, but there also times Python is just not a […]