CONSTRUCT - Adding Functionality to the Overall System

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon Sep 18 08:57:30 EDT 2006


"Calvin Spealman" <ironfroggy at gmail.com> wrote in message 
news:mailman.210.1158518497.10491.python-list at python.org...
> On 17 Sep 2006 09:22:16 -0700, Ilias Lazaridis <ilias at lazaridis.com> 
> 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)
>
> This is a terrible idea. When my, Joe Modulewriter, released my
> library of AwesomeCoolClasses, i except my metaclass to be something
> particular and if it starts getting wonky and I do anything hackery on
> my end with the types, then the end-user's computer might 'splode!
>
> What I am trying to say, is its a terrible idea to go changing other
> peoples' classes at runtime without knowing the real affects of what
> is going on. If you are just going to shoot yourself in the foot, why
> should we even give you a gun?

Reminds me of when I was learning Smalltalk, and modified printOn (ST's 
equivalent of str()) of the root-of-all-classes object class.  I don't 
remember the exact error I made, but it was a mess undoing it!

-- Paul





More information about the Python-list mailing list