Tuesday, 8 July 2014

Why I use Python

There are a lot of holy wars between programming language advocates in the industry.

I use Python.

Why?

Because I have found that programs written in Python are significantly more likely to Work Correctly. They more often run correctly the first time, therefore I spend less time debugging.

There are lots of other reasons, but it's mainly the "It just works".

A few years ago, I had 10+ years of industry experience of Perl, but only 1 year of Python. I already found that my Python programs initially worked correctly FAR MORE OFTEN.

This is comparing a language that I'd been using commercially, most days, for 10 years, with something that I'd only just picked up.

That's why I use Python.

---
Other stuff?

DEBUGGING: Stack traces. In Perl, it's possible to get a stack trace from an exception, but you sometimes have to jump through hoops to do it. Likewise, in PHP, stacktraces are available in principle, but don't always appear when you need them. Java? Stack traces usually appear, but are often huge and difficult to read (even better: in some versions of Java, the compiler "optimises" out line numbers from stack traces) In Python, stack traces Just Work. Like everything else.

2 comments:

Roman Kleiner said...

I also would prefer Python to Perl any time of day. It's not so much the stack traces (they are not easy to get in asynch Python either), but readability, co-routines, and balance of functional and imperative language.
But, coming from C++ background I still can't get used to how little help the running environment provides. You can write an utter garbage in an error handler, and the language just swallows it. This is of course common to all scripted languages.

Roman Kleiner said...

I'd also choose Python over Perl any day. The "many ways of achieving the same goal" of Perl just does not sit well with me. Also, Python nicely combines some functional elements, such as lazy sequences and co-routines, with imperative languages.
However, I still think that people choose scripted languages too often - where speed matters, I'd still take C++ or Java.