This week’s post isn’t about actual coding. It’s more about programming languages in general. More specifically, this post answers the following three questions:
- What do you like about your most often used programming language?
- What don’t you like about it, and why?
- What paradigms does your language support?
Obviously, the answers are completely subjective. So, let’s begin.
I like Python. It’s not the only language I code in, but it’s my language of choice for most tasks. There’s a number of reasons for this preference:
Until recently, I didn’t really have much to say about why I don’t like Python. But then, I saw “Python vs. Ruby: a Battle to the Death”. One of the great points made in the video is:
Python is relatively syntactically inflexible.
In plain English, this means that you can’t extend the Python language itself by adding things like new control statements. This is possible in some other languages, like Ruby. Syntactic flexibility enables more expressive code like RSpec and makes mundane testing code read more like plain English. To summarize, the above video offers the opinion:
Ruby is ugly; Python is beautiful
Nose is ugly; RSpec is beautiful
After playing around with Ruby for a short while, I’m starting to agree.
Another small gripe I have about Python is that you need to keep track of which version of Python you’re working with, since the standard libraries continue to change slowly, even between minor releases. For example, the following code:
import collections counter = collections.Counter()
will work perfectly fine on my dev machine, which runs Python 2.7, but will crash on a production environment that runs Python 2.6. On top of that, there’s also Python 3, which isn’t backwards compatible with the more commonly used Python 2.
Python is procedural, imperative and dynamically typed. It supports the object oriented and functional programming paradigms. Function arguments are passed by class references (in newer versions of Python, everything is a class).