[Tutor] Dynamic Method Creation

Alan Gauld alan.gauld at btinternet.com
Thu Jul 10 19:47:43 CEST 2008

"George Flaherty" <George.Flaherty at sas.com> wrote

> ) dynamically through the ruby method define_method(http://www.ruby-
> doc.org/core/classes/Module.html#M000396).
> > This functionally allowed me to create any number of methods
> dynamically within a particular class.
> ....I am pretty sure python can handle this?

I'm less sure. I suspect there are other ways of doing it, but none
so elegant as Ruby. This is one of several areas (IMHO) where Ruby
has learned lessons from Python and improved on it.

There are some things that I think python does better than Ruby
but there are certainly areas where Ruby does it better. Ruby
blocks v Python lambdas for example!

Alan G 

More information about the Tutor mailing list