Now is better than never.
Python is a seasoned programming language that experienced a renaissance on the Web. Its painless use offers several modern technologies such as duck-typing, automatic memory management using a garbage collector, late-binding and off-site rule indentation.
Personally, I was not taught Python in school or college, but rather I grasped it by taking part in the pilot Massive open online course (MOOC) programme from Stanford, where various AI techniques were illustrated in Python. Yes, AI, stuff of science fiction – no longer so. Least to say, coming from a Java world, I was amazed at the clear and compact code that I was soon creating.
Beautiful is better than ugly.
In this post we’re using the philosophy (or “Zen”) behind Python as our headings. It encourages you to write code that is easy to understand, quick to write and powerful in execution. Practically, “pseudocode that compiles” – quite handy for collaboration!
Many cool sciency stuff that are all the rage can be done in Python – Natural Language Processing, Sentiment Analysis, Computer Vision, Machine Learning, to name a few.
Simple is better than complex.
One of the more mundane, but no less exciting, areas where Python shines is Web Development. Since there is no reason to write the code for the web from scratch, there are several Web frameworks, each suitable for a particular case and need. Django, named after the famous Jazz player Django Reinhard, is a Web framework for Python with one of the largest active communities and it is really easy to get started with. It comes “batteries included”, meaning that many features, such as those related to security, databases, administration and templating, are there ready to be used.
The MVC pattern is implemented, the DRY principle is observed (Don’t Repeat Yourself) and the ORM layer is placed on top of database queries, making code cleaner and safer.
Here are a few of the Web’s most popular sites that use Django, as seen on Stack Overflow:
- The Onion
There are also many good libraries that can enhance your Django applications – such as South, Django REST Framework, Beautiful Soup, to name a few which we’ve been using here.
Complex is better than complicated.
The world (and the Web) tend to make things complicated. Most major hosting packages you may find for yourself support PHP only or come with preinstalled systems, which do not include the latest wave of cool languages like Python and Ruby for instance. Sometimes when you do find a willing host you will need to “rough it out” until you get everything working.
The benefits of “charming the Python” are worth it. It is secure – it’s never had a zero day exploit, it is predictable and strict and it has clean code which means easier maintenance and collaborative work which means – less errors!
There are also some really good, now industry-standard, options you can do to it regarding optimisation. Stuff like Celery, Memcached, using Nginx for a server…
In the face of ambiguity, refuse the temptation to guess.
Of course every programming language is but a tool to get the job done. And of course, not every tool is useful in all situations. What is important is the problem and understanding it. Then using the most suitable tool to solve the issue.
In an era of accelerated development processes and highly competitive environments, Python helps us build secure and scalable web sites. It’s for perfectionists with deadlines – and we always have some cool new products to deliver!