Perl/Python/Ruby common backend (Parrot, can Ruby play too?)
Tim Hochberg
tim.hochberg at ieee.org
Tue Aug 7 17:17:54 EDT 2001
"Andrew Dalke" <dalke at acm.org> wrote in message
news:9kpeft$kbm$1 at 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
More information about the Python-list
mailing list