February 2009 Archives

Python *sigh*

|

After years of dislike, I may have to admit that I'm not entirely filled with hatred for Python. This did not come voluntarily, mind you. My love of laziness naturally breeds a lot of small projects; why repeat a task over and over when I can code something once and not have to think about it again?

My love of laziness was thrilled when I introduced it to web services some years ago. Now there was a place for my apathetic side as well - why bother learning what over people have coded, when all I have to do it point my code to a web service (ReST was a natural choice *rimshot*)?

A situation arose where there only real way to get something done without reinventing the wheel (avoiding a joke about things being chowned and chgrped to 'wheel') was to consume a web service. Finding a chunk of code where the consumption was already written was easy, but it happened to be in Python. I swallowed hard and decided to use it anyway, creating a Frankensteinian script wherein PHP passed arguments to a Python script which made the web service call and passed the results to a Ruby script (I never managed to work in Erlang).

As the benefit of that particular script became apparent, I made use of the Python section again and again. I finally realized that it was impossible to do any sort of sane version control since there were at least three script files to be updated per 'script'.

On one particularly slow day I decided to try to rewrite one of the aging scripts in pure Python. It worked and was a lot cleaner. I've written some subsequent scripts in pure Python as well, and a lot of my dislikes remain:

  • I hate converting every single number to a string before concatenating it to another string
  • Python, your implementation of lists is hideous
  • I don't want to have to track eleventy billion import statements
  • The whitespace is just annoying. I know how to write clean-looking code. Sometimes I just don't want to.
  • Get a damn case command. Virtually every other language in common use has one.
  • As I've said before: Twisted Python (which admittedly is not part of the Python core) tries way too hard to behave like Erlang. Just learn Erlang and be done with it.
  • String manipulation is the most counter-intuitive crap I've ever seen. x86 assembly makes more sense

That being said, it's just possible that perhaps Python isn't quite as evil as I once thought. Python, at least you're not Java.

"At a meeting of the Enterprise Gun Clnb,
hold at McKoosport. Pa., recently, the
following officers were elected: President,
Charles H. Baird: vice president. Fred
Gross: secretary. George W. Mains: treas
urer, .7. F. Calhoun: captain. Phil Ratzsch;
executive board, Charles Baird, George W.
Mains. Phil Ratzsch, C. L. Reily, Harvey
McFarland. A tournament will be held on
May 30."

Sporting Life, April 23, 1904

http://www.la84foundation.org/SportsLibrary/SportingLife/1904/VOL_43_NO_06/SL4306022.pdf

About this Archive

This page is an archive of entries from February 2009 listed from newest to oldest.

January 2009 is the previous archive.

March 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.