CONSTRUCT - Adding Functionality to the Overall System

Ilias Lazaridis ilias at lazaridis.com
Fri Sep 22 14:26:39 EDT 2006


Steve Holden wrote:
> 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).
>

Followup thread:

[Watching this topic]  	CONSTRUCT - New/Old Style Classes,
build-in/extension types
http://groups.google.com/group/comp.lang.python/browse_frm/thread/493d71f3dd09939b




More information about the Python-list mailing list