Python or Ruby or PHP

Well…PHP isn’t really an option.  Only Ruby or Python  🙂

As many of you may know, I started off right out of college doing C/C++ programming and finished my software development days with Java.   Since then I’ve been doing application security.   When I do program now, it’s mainly for my own uses and it’s typically in Ruby.

I became interested in Ruby when Metasploit was ported to Ruby.   But in general, the prominent language for scripting related to security is Python.  So, I decided to experiment more with Python.

Right off the bat I’ve found a few things that are annoying

  • White-space scoping.   This is a common complaint if you’re used to languages that are more free-form and have explicit ways to scope.  But, in modern editors take care of it for you and it does enforce a consistent style.  It still bugs me some, though.
  • Library compatibly between versions.  There seem to be two major versions – 2.7X and 3.0.  I’ve not really done enough to know the difference, but there does seem to be a difference in community support for libraries between the two.
  • OO.  There are couple of interesting things about this.   First, why the explicit self parameter as the first parameter to every method?  Second, things like the len function.  It is used to determine the length of many different types of data.   But things like lists, should have a len method IMHO.  They do have a __len__ method, but nothing I’ve read talks about calling it.   It seems like the standalone len function expects it’s target to have a __len__ function so it knows how to get the length.  Why not just have len on the target?  It just seems not well thought-out.