CONSTRUCT - Adding Functionality to the Overall System
Steve Holden
steve at holdenweb.com
Wed Sep 20 12:15:42 EDT 2006
Michele Simionato wrote:
> (I don't believe I am responding to a notorious troll ...)
>
Believe it. You are. Ain't life a bitch? :-)
> One (bad) solution is to write in your sitecustomize.py the following:
>
> $ echo /usr/lib/python/sitecustomize.py
> import __builtin__
>
> class Object(object):
> def debug(self):
> print 'some debug info'
>
> __builtin__.object = Object
>
> then you can do for instance
>
>
>>>>class C(object): pass
>>>>C().debug()
>
> some debug info
>
> All class inheriting from object will have the additional debug method.
But sadly not the built-in types like int and str, which is what our
trollish friend wants to do (for some reason best known to himself).
> However I DO NOT
> RECOMMEND THIS SOLUTION FOR ANY SERIOUS WORK. For instance, it broke my
> IPython installation and I am pretty sure it will broke other things
> too.
> But it may work for debugging purposes, if not for production use, so I
> thought it was worth
> posting.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list