Created in the early 1990s by Guido van Rossom, Python has grown in popularity over the years. In 2016, Python is the 4th most popular language after Java, C and C++. Python is a general purpose programming language, and it can be used in a variety of fields. To quote Kenneth Love from Treehouse —
When I need to build a web app, I reach for Python. When I need to automate some small task on my system, I reach for Python. When I want to find the most common colors in an image, I reach for Python.
Python is a popular choice for writing scripts for testing and monitoring. Python has also been used for game development, and its ability to be integrated with other languages makes it very valuable in the process. Such is the popularity of Python that it’s also been used by George Lucas’ Industrial Light and Magic (responsible for special effects in the original Star Wars trilogy) to manage its complex production process.
Unlike PHP, it wasn’t built for the web in mind, and there are no core web functionalities that are integrated into Python. Hence, we must use a web framework to develop web applications in Python. Web developers have started using it for the web since the rise of popular frameworks like Django.
What makes Python the go-to language for an increasing number of developers when it comes to web development these days? We’ll try to find an answer to this question in this post.
Why use Python?
Python for beginners
The primary reason for the popularity of Python is the elegance of the code — the brevity and readability in particular. For instance, let us look at how Python and Java stack up against each other in terms of reversing a number:
Programs to reverse a number in Java (left) and Python 2.7.x (right)
Python provides a short learning curve, making it ideal for beginners to learn. In addition to that, if your project is Python-based and new developers aren’t familiar with it, the transition is easier.
As Quora co-founder Adam D’Angelo says on the choice of Python for Quora’s development —
So far, we’ve been pretty happy with the choice … all of the early employees who’d been working with other languages in the past were happy to transition to Python, especially those coming from PHP.
In fact, the webcomic xkcd came up with a cartoon on how easy it is to get things done in Python!
Further, Python has easy to use debugging tools. Although there are several debuggers and IDE tools, the default one is pdb, an interactive debugging tool which allows a developer to stop the execution of a program midway and assess the environment to better understand run time errors.
Python on a remote server
The management of packages (or modules as they are called) in Python is very easy too. Use a package installer like pip or easy_install and it can be used to install and remove packages.
Python is very portable too! The ease of transferring your development environment to a remote machine is commendable. You just need to export the packages, and install it in a virtual environment on the remote machine with just two commands.
One more reason why Python is a good choice for web applications is the ability of running scripts which are not embedded to the web server (unlike running a PHP script.) Scripts are run as separate processes.
Continue reading %Python on the Web: Why Frameworks Like Django Are Hot%
via Reme Le Hane