Hi lovely Ruby people,

I'm a Ruby programmer and I'm tutoring at the University of New South
Wales in Australia, a course which includes Python in its syllabus.
Needless to say, I'm in an excellent position to promote Ruby and I have
been doing so with the lecturer in charge and among students in my lab
classes.

The lecturer has agreed to let me give a lecture on Ruby (to
a couple of hundred university students who have just learnt Python).

I'm writing to ask for a few examples of things one can do in Ruby which
are much more difficult in Python. Aside from the many ways in which
Ruby is *a little* easier than Python (the net effect being substantial,
IMO), what are some 'real' differences that show up in practice?

Specifically, this is what my lecturer is asking me:

> I still can't find a good comparison with Python that is not
> superficial.  Sure, Ruby might be better designed, but how does
> this affect you in practice?  Can you give an example of something
> that can be done in Ruby that would not be so easy in Python?

My answers currently include 'meta' programming (trapping undefined
method calls, defining new class/module methods/attributes dynamically,
etc.), refactoring control flow (Python has generators but they're more
clumsy to use), invisible resource management (e.g. File#open { ...
}), Array and Hash being extensible classes (Python has UserList and
UserDictionary, but they're annoying and AFAIK do not work well with
the existing control structures which expect primitive lists and
dictionaries).

-- 
Greg McIntyre
greg / puyo.cjb.net
http://puyo.cjb.net