Related Entries

India PyCon 2009
Quick wallpaper changer
Load testing with Grinder
Adding namespace to XML
Opera RSS to OPML

« Linux on TV
» Linkfest - java articles

Python is bad

It is making it difficult to analyze code in other languages.

I spent more than half an hour trying to debug a problem in a Java code. I was half-asleep, but I couldn’t find what was wrong.

Looked at the specs. The implementation is about 100 lines. Kept dreaming about how this would have been about 10 lines of Python code (which is even smaller than the specs).

Scrolled up and down. No luck.

Cursed myself and actually started reading the code, trying to do a mental execution of each line. Aha! There is a line that compares two strings like string1 == string2. Modern languages don’t work like that - they need things like string1.equals(string2).

Obviously, I can’t admit I was wrong in scrolling up and down to find the error while not being alert. So, it must be an issue with Python. By removing noise ({}, ;, for(;;) etc.), I think Python has made my attention span a lot less. Most of the things I see in Python code are there for a reason - which is reasonable to fit my brain. Essentially, Python is WYSIWID (What you see is what it does).

These days, when I try to figure out C# or Java code, I’m not able to ignore the braces and semi-colons as I used to do with C and C++ till I started using Python.

After 30 years of evolution of Computer Science, I think the progress has been very poor - I mean, why does an application programmer need to know about stack and heap memory management to compare two strings?

  1. Haha, yes I've made that same mistake in Java. You're right, Python is "bad" because it makes you think that the language should make things *convenient*, not make you have to think about the underlying representation. Python sets our expectations too high. The Python libraries are even "worse." They convince us that disparate libraries should behave in logical, standard, easily understandable ways, and if an object is similar to a list or dictionary, it should just *behave* like a list or dictionary, instead of implementing its own methods with horrendous quirky names like getAnother(), next(), retrieveNext(), findItemForKey(x), etc. And what "language mechanism" does Python have that *enforces* this? Uh, none. People just do it because, uh, they are sane. Hmm.

    Posted by: Tom on September 8, 2003 12:53 PM
  2. :)

    Posted by: Richard Jones on September 8, 2003 06:02 PM
  3. I don't think == has anything to do with stack and heap memory management, and to compare two strings, all you need to know is that .equals does that, and that == in Java is an operator that compares whether two objects are the same exact object.

    Posted by: Keith Lea on October 8, 2003 06:06 PM