Sitemap

Disorganized thoughts on Python vs. Ruby

2 min readSep 21, 2014

I started my programming career, such as it is, with Eric Grimson’s MITx course in Python. After three months or so of programming in Python, I jumped ship to start working in Ruby in order to prepare for the Launch Academy bootcamp program, which is focused on Ruby on Rails. So how have I found the transition?

Overall, the extreme similarity between the languages has been both a boost and a stumbling block. Much of my intuition and vocabulary from Python still applies, but I still regularly get pulled up short by little differences. (“What do you mean, I need to add an end statement to that if block? I didn’t indent the next line, isn’t that enough for the interpreter to figure it out?”) By comparison to the little Javascript (a much more foreign language) I have dabbled in, I spend a lot less time looking up how to do basic things in Ruby, but a lot more time debugging and searching through the code for the little bits of syntax that are just a little bit off.

Get Christopher Wand’s stories in your inbox

Join Medium for free to get updates from this writer.

Some more specific assorted thoughts:

Ruby is definitely more flexible in its syntax, in terms of providing lots of different intuitive ways to do the same thing. This is really nice and helpful 95% of the time, but I’ve already seen some places where it could get ugly. For example Ruby’s “Everything’s a return statement!” approach to methods seems like it could cause badly written methods to produce all sorts of unexpected and hard to debug results.

Ruby’s system of blocks, procs and lambdas seems really flexible and powerful, much more powerful than anything in Python, but honestly I haven’t gotten my head around it enough to do more than the simplest tasks.

I’m not sure if it’s just that I haven’t really grokked Ruby’s scope system yet, but it seems a lot more complicated and harder to use than Python’s. I much more frequently run into issues where the scope of a variable trips me up in Ruby. (Of course the flip side is that Python gives you a lot more rope to hang yourself with by letting you mess with variables in other scopes in ways that can cause a real mess if you’re not careful).