Adding a field to a 'foreign' object from the outside

Scott David Daniels Scott.Daniels at Acm.Org
Fri Jan 23 14:45:08 EST 2009


Steve Holden wrote:
> .... Write a class that implements a __call__() method, and use an instance
 > of that class as your callback. Then the data can be stored as the 
callback
 > object's private instance data.

In fact, you needn't name the method __call__.  You can pass in
Holder().method if you have no other use for the instance of
your Holder instance.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list