Since the advent of modern computers, hundreds of “high-level” programming languages have been developed and many different directions have been taken, depending on whether the language designers wished to emphasize features, speed, error handling, pedagogy, theories of computation, correctness, or simplicity. As evolution marches on we see great entering of Python.
Python is a high-level programming language created by the employee of the Dutch Centrum Wiskunde & Informatica (CWI) Guido van Rossum in the 80s. He resigned in July 2018 but remains Benevolent Dictator for Life Emeritus. Currently, Python is confidently held in the top five most popular languages. It supports the basic programming paradigms (OOP, functional style, non-strict typing, the size of variables is unlimited, which is good for computation), and therefore selected by a number of educational institutions as a start of learning programming. More than 70% of the US educational institutions use the Python as an introduction for coding. Let’s have a look at the philosophy behind the language.
The Zen of Python is a collection of software principles that influences the design of Python Programming Language. Python programmers take the Zen seriously, it helps them write pure and beautiful code. Let’s have an overview of the main principles:
Beautiful is better than ugly
Though it is subjective, code seems more readable and beautiful when use and, or instead of &&, || respectively. Python provides many syntactical elements to concisely express many common program flows. Of course, the mathematical beauty comes from the algorithm, but it’s just fascinating the way Python succeeds at being precise, concise, explicit and elegant at the same time.
Explicit is better than implicit
Every time you invoke a function you should name its module explicitly
Simple is better than complex
Developers spend more time thinking about the problem they’re trying to solve and less time thinking about language complexities or deciphering code left by others
Complex is better than complicated
It is okay to build very complex applications, as long as the need for it is reasonable
Flat is better than nested
Flat data structures are typically easier and faster to parse, and should be preferred over nested data structures. Where you need nested data structures, prefer shallow rather than deeply nested
Sparse is better than dense
The number of features in the language itself is modest, requiring relatively little investment of time or effort to produce your first programs
The Python syntax is designed to be readable and straightforward. This simplicity makes Python an ideal teaching language, and it lets newcomers pick it up quickly
Special cases aren’t special enough to break the rules.
Languages and libraries should aim for consistency and should support the general case. Resist the temptation to pile on support for special cases that are useless for nearly everybody. Let the caller handle their own special cases in their code
Although practicality beats purity
Unless there are good, practical reasons for supporting a special case
Errors should never pass silently
Errors should be treated as errors. Library code should always report errors that occur, and not just silently suppress them
Unless explicitly silenced
Users should have the option to explicitly silence errors they don’t care about
In the face of ambiguity, refuse the temptation to guess.
If a situation is ambiguous, functions should not try to guess what the caller meant. They will sooner or later get it wrong
There should be one — and preferably only one — obvious way to do it.
There should be one module for every need
Although that way may not be obvious at first unless you’re Dutch
Sometimes what is obvious to Python’s designer, Guido van Rossum, who is Dutch, may not be obvious to anyone else who doesn’t share his background. Live with it
Now is better than never
If something needs doing, it is better to do it now than to procrastinate and never get it done. Don’t wait for software to be perfect – you can measure many things with a ruler with a notch in the side, and even a blunt saw cuts better than no saw at all
Although never is often better than ‘right now’
But sometimes it is better to do without than to lock yourself into a faulty standard. If there’s no solution that’s good enough right now, it may be better to wait for one than to be stuck forever on a bad solution
If the implementation is hard to explain, it’s a bad idea.
There might be a mistake if the implementation of software is hard to explain, thus it is recommended to reconsider possible solution.
If the implementation is easy to explain, it may be a good idea.
Some ideas are just bad, regardless of whether they are easy to implement or not.
Namespaces are one honking great idea — let’s do more of those!
Namespaces are a tried and tested solution to many programming jobs. In Python we love to use it a lot.
As one of the main principles of Python is simplicity, most tasks can be resolved in several lines. The language is very convenient, it has a strictly defined code format, which makes the code itself easy to read and easy for refactoring, changes, etc. Python benefits from both a strong standard library and a generous assortment of easily obtained and readily used libraries from third-party developers. The Python knows how to call the code, written in different other languages, from its libraries, which makes usage of libraries in another language possible. In Python, everything in the language is an object, including Python modules and libraries themselves. This lets Python work as a highly efficient code generator, making it possible to write applications that manipulate their own functions and have the kind of extensibility that would be difficult or impossible to pull off in other languages. Scripting and automation cover a large chunk of Python’s use cases. Python may not be the fastest language, but what it lacks in speed, it makes up for in versatility.
Python has one of the most friendly and responsive communities. They wrote a lot of libraries and frameworks, which gives a lot of flexibility to resolve the tasks. It is very easy to find libraries in order to solve a particular problem, that time saving is customer money – as a result, the code is written 2-3 times faster than if you use Java for a similar task.
Python is used in different fields, many even simply say that “Python can do everything”. As a multi-paradigm language, it allows developers to build their programs using multiple approaches, including both object-oriented programming and functional programming. Some choose it as the main language, then it can develop full-fledged applications on different platforms, some prefer to use it as an additional one, for example system administrators use Python to write scripts that control other processes on servers, which extends the scope of this language.
Many tech giants use Python to develop their product, here are some great examples:
Furthermore, Python is widely used in gaming industry:
In Limestone Digital we decided to create a group of those who are interested in Python. We gather weekly for short tutorial sessions, which are moderated and led by me. At the moment during the meetups we cover all the basics, in the future we plan to deepen into the language and to study different libraries. Definitely it is a good practice as the team have a possibility to increase their tech stack and it’s kind of team-building for the company.
Python is a wonderful language for both beginners and expert programmers, but getting started can be complicated. Basing on needs and tasks there might be different approaches to which version you should stuck, which editors are best, which implementations and environments to choose. For the most of the tasks we recommend following parameters:
To stay competitive in our field and provide our customers with custom applications and system enhancements, the staff need to be thought leaders in their areas of expertise. In Limestone Digital we not only hire proven experts, but we encourage continual education and training amongst our technical teams. The result has been the development of a strong team with proven record and a valuable tech asset to our common knowledge bank – Python Programming Language.