CONSTRUCT - Adding Functionality to the Overall System
Michele Simionato
michele.simionato at gmail.com
Wed Sep 20 11:49:39 EDT 2006
(I don't believe I am responding to a notorious troll ...)
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.
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.
Michee Simionato
More information about the Python-list
mailing list