Python - Why

python

Why should we use Python or not?

  1. Python provides generators, both as expressions and from functions. Generators allow for iterative processing of things, one item at a time. This doesn't seem so fancy, until you start to realize that normal iterative processing of a list. A list takes memory. A really big list takes a lot of memory. This becomes particularly handy is when you have a long chain of processes you need to apply to a set of data. Generators allow you to grab source data one item at a time, and pass each through the full processing chain. Using the generator-based migration tool collective.transmogrifier I can read data from the old site, make complex, interdependent updates to the data as it is being processed, and then create and store objects in the new site all in constant memory. For applications where you are dealing with even larger data sets, this sort of tool can be indespensible. David Beazley has a great slide deck online that provides some very compelling examples of using generators for system tasks. Take a look and see what sparks start flying in your imagination!
  2. Python is Fast. Python is an interpreted language, so it is inherently slow, but some amazing work has been done over the past years to improve Python's performance. The PyPy project aims to speed up Python as a whole (and is doing a great job of it). Numba can offer amazing speedups simply by adding decorators to code you already have. If you want to do high-performance computing, Python is a viable option today.
  3. Python is Broad. Python has been around for quite some time now, and is used in nearly every field of endeavour. A reddit thread asked the question how do you use Python at work and the answers show tasks ranging from systems automation, testing, and ETL to gaming, CGI and web development. Disney uses Python to help power their creative process. Mozilla uses Python to explore their extensive code base and releases tons of open source packages built in python. Checking PyPi, the public package index for Python, shows 40 thousand add-ons available, across nearly 300 listed topic categories. Basically, if you want to do something in Python, chances are pretty good someone else already has, and you don't need to start from scratch.
  4. Scientific Computing. Much of Python's popularity is in fields like scientific computing. Advanced systems like NumPy and SciPy were started not by teams of software engineers, but by domain experts building the tools they needed to get a job done.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License