Python's Lisp heritage
Andrew Dalke
dalke at dalkescientific.com
Sun Apr 28 15:18:49 EDT 2002
synthespian:
><sarcasm> No kidding! You can modify your classes?! Gee, I wonder if you
can do *
>that * in C++ </sarcasm>
>But can you modify them * in runtime * ?! Without halting your
>application and, say, recompiling? <smirk>
>Answer: NO
>Only in LISP can you do that.
>That's why NASA is so fond of using LISP on their probes.
>And what's this discussion Python X LISP? I thought Peter Norvig's
>article already had cleared that up (that Python is a LISP from people
>who never understood CONS).
I'm not sure what your point is here. In more recent Pythons (1.5 and
newer, I think) you can do
>>> class Spam:
... def what(self): print "I'm spam"
...
>>> class Eggs:
... def what(self): print "I'm eggs"
...
>>> x = Spam()
>>> x.what()
I'm spam
>>> x.__class__ = Eggs
>>> x.what()
I'm eggs
>>>
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list