4540l1.txt

Listing 1. Installing a Mix-in Dynamically

[gt]python
Python 2.0 (#1, Oct 16 2000, 18:10:03)
[GCC 2.95.2 19991024 (release)] on linux2
[gt][gt][gt]
[gt][gt][gt] class Friendly:
...     def hello(self):
...             print 'Hello'
...
[gt][gt][gt] class Person:
...     pass
...
[gt][gt][gt] p = Person()
[gt][gt][gt] p.hello()
Traceback (most recent call last):
  File "lt;stdin[gt]", line 1, in ?
AttributeError: 'Person' instance has no attribute 'hello'

