Sunday, December 07, 2008

I don't get Python 3.0

I often get a lot of crap from friends and co-workers for being an early adopter, but I can tell you that one thing I can't see myself adopting soon is Python 3.0. I just don't get what the benefit is. Most of Python's ugliest warts are still there, and the things people liked have been mucked with.

For example.

len("string")

Why am I still typing this when strings have been a first class object in Python for more than 10 years? "string".length(), right? This is how every other language where strings are objects has handled it, and Python should.

Another example.


class A:
def blah(self, i):
print("The number is: %d" % i)


This example changed something that didn't need to be changed and didn't change something that did need to be changed. The former is, of course, the ever-controversial print statement in Python. This is probably the change that will break more lines of code than anything, and did it really need to change? And I loved the way the % operator worked.

The latter is the "self" in every method of an instance. Why... oh why... do people have to type this? "self" is absolutely needless, and tricks with methods that don't, I think, are confusing and should have been broken with this release.

The bottom line is, if Python 3K is supposed to be the last time for a long time there's a major breaking change to this language, then why not fix everything? Why not work out a solutionj to the GIL? Guido works for Google, and Google uses Python. He should have the resources to fix this stuff, right'?

I've used Python for 13 years now. 3.0 makes me wonder if I should migrate to IronPython. Not only can I write extensions in C# and use the .NET Framework, but it runs on the CLR.

1 comment:

Anonymous said...

Could be worse. They could have chosen \ for a namespace separator.