Monday, December 1, 2008

I hate python, part trois: The mysterious case of the anorexic syntax checker

One thing that's really annoying me about python: Python sucks at syntax checking.

Let's say I create a class in python, named myclass:

class myclass:
def __init(self):
print "Hello world!"

And I'm using this class for some part in my program. Well, everything goes fine in my program UNTIL I call this class. I get this message:
TypeError: this constructor takes no arguments

I have two problem with this:

First, the message really doesn't tell me ANYTHING. It doesn't say "myclass constructor not defined".
Second, it doesn't even tell me when I START the script! Why, oh why, python doesn't have a correct syntax checker? It should spit out right when I start the script: "Hey, you! You forgot to add the trailing __ to myclass.__init, duh!"

I'm really starting to miss C++. If I compiled a program in C++, I would have gotten an error about an undefined constructor *RIGHT ON SPOT*. There shouldn't be the need for a unit test when the problem is a SYNTAX ERROR!

I don't know who was the moron who said he loved python "because I can start writing the unit tests faster, so my development cycle is more efficient". That's bullcrap.

The speed you gain in omitting the "c++ formalities" is lost tenfold at debugging simple syntax errors... that appeared minutes after you started your application.

Let me say it again: A trivial error like this would be spotted by a C++ compiler INSTANTLY!


No comments: