Banging rocks together in Python

October 31, 2008

One of the things I continue to like Python for is what I call 'banging rocks together': quickly programming relatively small but non-trivial things, on the order of a few hundreds lines and anywhere from an afternoon to a few days of time. A representative example would be the basic UDP request/response bandwidth tester that I recently wrote; it came to a bit under three hundred lines of Python with some comments, and took me perhaps a day or two of time to write, tune, make more complex but more useful, and polish a bit.

I find that Python has a number of advantages for this:

  • it has some pretty big rocks, so you can get pretty far without too much work.

  • it runs surprisingly fast enough; for example, my UDP ping-pong tester could saturate gigabit Ethernet without very much tuning. This too means that you can get pretty far without too much work.

  • it has enough power that you can scale your program up to more sophistication if you need it. The UDP ping-pong tester started out doing very simple things, but they turned out not to be at all representative of how UDP NFS behaved on problematic networks; I was able to make it more complicated without particular much work.

(My end result turned out to still not be representative of what happens to UDP NFS performance, but at least it stopped giving hopelessly optimistic answers and melting networks down in the process.)

This is not unique to Python, of course; I'm sure that Perl would be as good, as would a number of other modern 'scripting' languages. What matters is a certain expressive power coupled with large rocks, and Perl certainly has a very good collection of large rocks.

Written on 31 October 2008.
« How Linux initrds used to be a hack
Why realistic UDP bandwidth testing is hard »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Oct 31 01:35:13 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.