2014-03-15

Picky Python

I first discovered Python back in version 1.4, in 1996. It's been my favourite programming language since then.

One of the things I like best with Python is that it's designed to make it easy to make things right, rather than hard to make things wrong.

There is still a lot of code which could be improved a lot. There are several reasons for that:
  • One way or another, the problem is often that the programmers don't know Python so well.
  • Some seem stuck in the idioms of another language, such as C. A variant is people who try to compensate for the lack of static typing, rather than make use of dynamic typing in an efficient way.
  • Many reinvent the wheel instead of using the vast flora of libraries available in the standard and in the Cheese Shop etc.
  • Since Python is easy to learn, it's often used by people who aren't hard-core programmers. While they will do much better with Python than with e.g. C++, they'll still make beginner's mistakes.
  • Regardless of language, there is a lot of software which was written with less care and attention than it deserved. Perhaps because the programmer didn't have to maintain it?
  • I've seen a lot of poorly written code in corporate settings, and that's really an organizational problem, rather than a personal: Companies can hire the right people, train them well, establish a culture of software quality and provide constructive goals and priorities. Or not! As Deming said: Don't place blame on the workforce

I thought I'd write a bit about problematic Python constructs I've come across, explain why they cause trouble, and what to do instead. That's the main thought with this blog. Hopefully, it will help someone now and then...

No comments:

Post a Comment