From PHP to Python

Before I wrote my “Dear John” letter to PHP the other day, I had largely decided to move to Python as my primary tool. I had been on the fence for months about choosing to pursue Ruby or to follow the Python path. I purchased a book about each and did quite a bit of other research as well. The fact that there are so many passionate flamewars about which is “better” was actually quite helpful. It proved a suspicion that I had formed during my research: it didn’t really matter which one I chose. There would be nothing to argue about if one were clearly the best language to learn. There isn’t a whole lot of debate about which is better for web development: Python or Lisp, Ruby or Delphi? Since Python and Ruby both are very suited to web development, it really boils down to personal preference. Having experimented with both, here is why I chose Python. Your mileage may vary.

Similar purpose, different philosophy

I primarily dinged PHP for not having a what I call a guiding philosophy. There seems to be a disconnect between Zend Technologies and the PHP community and that lack of focus is crippling PHP. In some ways it reminds me of the relationship Red Hat has with the OSS community. Neither seem to completely trust each other and there’s friction when deciding on how to move a project forward. Almost from Day 1 (well, make that PHP 3.0) Zend seems to have focused more on building a language around a business rather than the other way around. Trying to be everything to everyone, focusing more on the quanity of installations rather than security, and borrowing features rather than innovating isn’t a recipe for success in the world of open source. That sounds more like how commerical software is churned out.

I find both Python and Ruby are far more community-driven and focused. However, the communities both have distinct, and dissimilar, philosophies. Ruby is the kindergarden teacher who gives each of her students the big, 64-color box of Crayola crayons. The children are given the freedom to draw a dog in whatever manner they choose. In Python school, students assigned only four crayons: red, yellow, blue, and black and are given step-by-step instructions on how to draw the best dog possible. Now, I’m not saying that Python has less features than Ruby. The Python community simply has a more formal structure and and a greater focus on the nuts-and-bolts of improving the language as a whole. Ruby is less inclined to define specific guidelines and prefers to give programmers several options, allowing her/her to pick and choose.

Ruby’s community more closely maps to my personality (hey, my company is named RightBrain Networks). However, I am finding myself involved with increasingly larger web projects, both solo and with other developers. When developing a large project, even solo, consistency is paramount. The less time I spend figuring out what the other guy’s code is supposed to do (or what I wrote last night at 3am), the better. It also saves me from having to research which one of the choices is best in my current situation. Ruby subscribes to the “Principle of Least Surprise”, meaning that the language ought to bend to the programmer. However, I find myself preferring Python’s approach, which is that if the language already knows the best approach, then I should bend to it. If we all agree that the “Python Way” is best, then we don’t need to adapt to each other’s individual styles. Hence, larger projects are both more efficent and fun because I can spend more time writing code than deciphering/researching it.

Is Ruby a one-trick-pony?

I’ve met more than one person who’s wanted to learn (or wanted to hire someone who learned) “Ruby on Rails”, not knowing that Ruby existed a full decade before being attatched at the hip with Rails. I’ve played with Rails and am quite impressed with its capabilities. However, what happens once the honeymoon is over? It seems like a risky career move to jump from buzzword to buzzword. I know that Ruby exists outside of the Rails, but I’m not sure how practical it would be to learn Ruby if I wasn’t jumping on the Rails bandwagon.

Both Python and Ruby have been around since the early/mid 90’s. Which has been better adopted by organizations that may wish to hire me? On there are currently 347 job listings with “Ruby” contained as a keyword. Of those 347, 95 don’t specifically mention “Ruby on Rails”. There are also 923 listings looking for someone with Python experience. While not strictly scientific, I feel that indicates that Python stands on its own merits, apart from its web frameworks, moreso than Ruby. Again though, I’m not talking technical points, which I feel both are very comparable. However, I would argue that employability should be given more weight than technical minutia when planning a career.

If the Rails framework started to take a direction I didn’t care for, I don’t really have many options. My skills wouldn’t be very portable. However, by learning Python, I can pick from several different, well-known frameworks: Django, TurboGears, Pylons, or Or if I even wanted to get out of web development, Python is used in many other applications.


While I like certain aspects of Ruby more than Python (as a newbie, the whitespace thing is still driving me nuts!), I feel that Python is overall a better fit for me. It’s greater emphaisis on structure will help make developing and maintaining large projects easier. And because both the language and the jobs aren’t so intimately tied to one framework, my skills are more portable and future-proof. I’m sure there are people out there that will disagree with my analysis, so if you’re trying to decide with path to take, please take the time to play with both of them and ask advice from both camps. Thanks for reading.