I went out to lunch with a couple of awesome local nerds yesterday. I was about twenty minutes late, but Stuart and Jason didn’t seem to care. I’m guessing that they got all their trash talking done before I showed up.
The conversation was all over the place. I had chugged my late-morning caffeine before arriving, and it was just hitting peak plasma levels when I arrived at the restaurant.
One thing we talked about was Python. I had a little love affair with the language a couple years ago, but didn’t ever do anything with it. I was just curious to know what all the Python hoopla was about. After finding out, I went back to my love.
Something’s going on, though, in the .NET camp. While I don’t have a lot of links to support it, I’ve noticed a growing interest in Python among my friends and acquaintances.
Jason has his bit here, and Sam has made Python a priority for 2005.
When I first looked at Python, my reaction was, “Thank heavens there’s a ‘P’ language that doesn’t mix the flexibility of Silly Putty with the arcaneness of C and the joy of trying to suck a watermelon through a crazy straw.” I hate Perl. ‘Nuff said. Python is often mentioned in Perl conversations, and I think it’s good for the world to know there’s an alternative, even if it isn’t trying to tackle the same problems as Perl. I just figure that, the more people off of Perl, the better. It’s like trying to get drugged teenagers off the street.
When I looked a bit deeper, I was less excited. Python feels like a “fun” language, but it falls short for me in a few areas. Since it’s relatively new, and since it’s a rather modern creation, I couldn’t figure out why parts of it stank.
[Note: The following is based on two year old memories, and could be inaccurate, but I know that it’s at least mostly right.]
First, if you haven’t done anything with Python, then here’s something very important for you to know: Versions of Python prior to 2.0 were a lot like pre-.NET VB in that they mixed a procedural style with OO. When coding with a 1.x Python, it’s easy for it to feel like VBScript. Your world is built around functions that are coming from who-knows-where. It wouldn’t have surprised me to have come across Instr(), Chr(), or Asc(). I hated it.
Python 2.x changes this by providing an OO framework for some operations. Instead of working with a string primitive and then coding against those strings using functions, you have a string object with all the associated conveniences. I… liked it.
I didn’t love it.
I would have respected a choice to have ditched all 1.x hacks, but instead they were carried over to 2.x, so now we had the choice of doing things procedurally or Object Orientedally (yeah – I made that word up – bite me).
What a bloody mess! Let’s see… Do I want to work with functions on my strings, or do I want to work with members of the string object? I hate that kind of crap. Choice and flexibility in expression are “feel good” features, but I tend to think that having a bajillion ways to do the same thing really screws a language over.
Then, there was this irritating business of the constructor. Who’s idea was it to call it “__init__”? What’s with all the underscores in the language? Here we (the coders of the universe) had a chance to clean things up, but instead we got this confusing syntax that feels like a last minute kludge.
Not that I think Python is the only modern language that should be picked on for strange constructors. I happen to think that VB.NET has it right: New(). It makes so much god damned sense. C# is the language I code in for pleasure, but having to have constructors whose names match the class name doesn’t strike me as being necessary, except perhaps to make C# coders feel that their language is somehow more technical than other, equally suitable .NET languages. Most C# coders I know are coding without 3rd party refactoring tools, and I can imagine that they’re often hesitant to refactor just because of the sheer volume of work sitting ahead of them. Not having to rename all their constructors each time they change a class name would allow them more flexibility to go back and make changes later, and New() is a fine solution to the problem.
But I digress. Switching back to Python.
After flipping out about the procedural/OO mix, and then getting all tight in the pants about constructor names, my cheeks burned with anger and frustration a third time when I realized I had to include self in every single bloody method signature’s parameter list.
If self needs to be listed, then why do we have to define it? Why can’t it just be done automatically?
You might think I’m bitching about unimportant issues here, but coding is one place where very small differences can make or break your day since so many tasks are repetitive. Sure, having to add self to a parameter list once isn’t any big deal, but three-hundred methods later, when the ink is worn off the S, E, L, and F keys, you might be thinking differently about it.
Now, to end this thing on a positive note, I’ll say this: I love the interactive environment of Python, and I love that it forces coders to indent. I think that Python makes a lot of sense as an embeddable scripting language for larger applications, and I think that, with a few modifications, it could be the best teaching language ever created.
And now I really have to shut up. My instinct is to go off about other features, but I really want this to finish positively.
Which is hard.
Because I kind of think Python sucks and is as overrated as OS X and Pink Floyd.