From: Tim Hochberg Date: 2001-08-15T01:30:29+09:00 Subject: [ruby-talk:19705] Re: Perl/Python/Ruby common backend (Parrot, can Ruby play too?) "Andrew Dalke" wrote in message news:9kpeft$kbm$1@slb4.atl.mindspring.net... [snip] > I learned a couple weeks ago of a reason to be able to add new > methods dynamically. I was at a talk where the speaker presented > a development system for non-programmers. It allowed them to > tweak the class definitions in-place. She chose Tcl (with an > object extension) over Python because Python's ability to add > new methods is not obvious[*] and because existing instances > are not updated with the new class definitions > > [*] Here are two ways - of many - that would be "obvious" > == 1 (backwards compatible) == [snip] > == 2 (not backwards compatible, but when I started Python > I thought this would work) == > > class Spam: > def what(self): > print "spam" > > class Spam: > def slice(self): > print "sliced" This looks kind of similar and appears to work (at the expense of slowing down all your lookups). (1) is prettier though...: class Spam: def what(self): print "spam" class Spam(Spam): def slice(self): print "sliced" -tim