Python Considered Harmful

Eric Lee Green e_l_green@hotmail.com
Sun, 26 Dec 1999 23:48:30 -0700


Sorry, a bit of a troll involved in the title :-(. 

Anyhow, I have been prototyping a fairly large project in Python, and have
come across some decided disadvantages as compared with more traditional
language. Specificationally:

1) The interface specification is the implementation. There is no seperate
".h" file such as with C++ that would contain the interface specification.
With a big "C" or C++ project I print out the ".h" files and there's my
interface specification (obviously I advocate and follow the practice of
writing your C or C++ in an object-oriented modular manner!). I don't care
about the implementation once the module has been debugged, all I care about
is its interfaces. I can see the interfaces for the whole project by flipping
through one slender folder with the .h files printed out. I can't do that with
Python.

2) Debugging is a mess. The problem is that I tend to "stub" things a lot, or
reference
functions that have not yet been written (they're in the design doc, okay, so
I know what their interfaces will be, I just haven't written them yet!). With
a compiled language I run the compiler and linker and it tells me "hey stupid,
you're missing something". With Python, I run it, and it tells me "doh, you
forgot to create a method for 'checksum_packet'. I run it again, it tells me
'doh, you forgot to create a method for 'register_connection'. I run it
again.... ad nauseum. 

Of course, there's the one big advantage of Python -- it's quicker'n greased
lightning for writing things in. I did in a month what would have taken four
months in C++... just getting  a bit irritated in the process with the whole
interface/implementation thing, because it's making keeping the design doc and
the implementation in sync a pain in the @%!#....

And it could be worse. It could be Perl.

-E