Thursday, November 09, 2006

Why Python? Actually why not python?

Eric Raymond (ESR) wrote "Why Python?" which is amazingly persistent in popularity on the linuxjournal.com website. I even asked ESR at a LinuxWorld what he thought about this fact and he remarked that he was pleasantly surprised. I can remember reading it and being inspired to try python. I used python in a successfully project and enjoyed it, mostly its dynamic nature. So, this blog is called ruby-talk, where am I going with this and what does it have to do with ruby? Let's see what led me away from python.

The repetitious "self" is often cited, but it actually did not bother me, nor did strict indentation. What really got me was the global keyword, pythons super syntax, and over abundance of web development frameworks. The web development framework situation has really changed and I only mention it because it was then an issue for me and would not be today.

Looking at the global keyword, say in a python module you might have:

foo = "bar"
def zoo:
global foo
foo = "baz"
end

This code shows how zoo can rebind foo, that is change it from "bar" to "baz" and have that change visible outside of zoo. I just could not get used to that and while it is small it continually annoyed me. Now, on to python's super syntax, for example:

class Derived(base.Base):
def __init__(self,x,y,z,**kw):
super(Derived, self).__init__(self,x,y,**kw)

Every time I looked at this it was not evident within seconds what is happening, nor obvious even after studying it. I won't explain it here as that is not my point, or intention, so if you need an explanation then you are getting my point here.

These may be small things, but they continually bothered me. I am thankful to "Why Python?" for getting me looking at python, but what it really did was get me on the dynamic language page. This led me to look at the other dynamic language Ruby. Upon looking at Ruby I began to see it was striking this really nice balance between several influential languages. What bothered me in python no longer bothered me in Ruby and I also gained some of the things I missed in perl. For me I am continually able to look at Ruby code from others, code I write, and it meshes nicely with the way I think. What a nice surprise.

0 Comments:

Post a Comment

<< Home