CONSTRUCT - Adding Functionality to the Overall System

Diez B. Roggisch deets at nospam.web.de
Tue Sep 19 10:34:14 EDT 2006


Ilias Lazaridis wrote:

> Ilias Lazaridis wrote:
>> I understand that I can use __metaclass__ to create a class which
>> modifies the behaviour of another class.
>>
>> How can I add this metaclass to *all* classes in the system?
>>
>> (In ruby I would alter the "Class" class)
> 
> I got confused from the discussion about __metaclass__.
> 
> possibly a little more practical.
> 
> I like to add a method "writeDebug(self, msg)" to all (or the most
> possible) classes in the system.
> 
> How do I do this?
> 
> * with new style classes
> * with old style classes

OMFG. For asking the question (paraphrased) "why do you want to do this",
Mr. Spealman received an

http://case.lazaridis.com/wiki/Please#OffTopicPosts

But now you do exactly that - give more details. Maybe this could teach you
the lesson that the variance of input you get here to your questions is
worth considering?

But I've got the wicked feeling that this won't happen...

Diez



More information about the Python-list mailing list