Hacker Musings and OCD

In the land of snakes

So I’m getting settled in to my new job. There’s a ton of things to get used to: a company with an extensive history (20-something years old); a large number of people (over 40); a product+service niche that’s pretty rarefied, replete with jargon and terminology; and a technology stack that has not very much to do with what I’ve spent the last decade doing.

The biggest change of that last bit is the switch to Python.

Python is fucking weird.

Yeah, there’s The Whitespace Abomination. The reality is, you get over it. It’s a HUGE deal at first; just awful, terrible, crap. It’s just the dumbest idea anyone could ever have, there’s no sanity to those arguments you see about readability, it’s some magical bullshit thinking. Lisp’s paren soup is NOTHING compared to this bullshit!

It just sort of goes away after a while. It’s still bothersome and weird but I’ve got my editor configured properly now, so generally it’s not really a problem. In fact I tend to end statements with a semicolon more often than making some indentation-related boo-boo!

Python is often called “easy”, and I think it lives up to that description. That said, I think idiomatic Python isn’t easy. Python wants to make it such that there’s one obvious way to do it; but is that one way actually obvious?

In the Python I’ve seen lately, they tend to do the Ruby thing of, “module M contains class C and also a grab-bag of functions”. I’ve spent rather a lot of time in the past few years doing what amounted to Java Lite: large applications are structured by interfaces, abstract classes, and implementations. So, the idea of “here is a class and also some functions” is just … odd. I sort-of get how it works with Python’s namespace/module system, and I’m sure it’ll make more sense as time goes on, but as a switcher it’s positively strange.

Also, tools like virtualenv and the more complex elements of the Python ecosystem aren’t immediately obvious. Coming from a background in PHP or Perl, Python can actually be pretty intimidating if you’re not working in an established platform like Django: what do I do about MySQL? What do I do about web server integration? What do I do about etc etc etc? Scoff all you want, but the fact is hitting http://www.php.net/manual/en/funcref.php is mostly all you need to get rolling on PHP projects, and of course CPAN remains one of the gold standards for code repos. (In fact, CPAN might be too large at this point.)

Anyway. I’ve written a couple of non-trivial Python scripts now, and I’m trying to get more into designing things to be “Pythonic”. We’ll see. I can’t say I’m happy with Python yet, but it’s still pretty new (it’s been all of a month) and so I’m at that strange place in the learning curve.