Prothon is switching to the .NET platform
Christopher T King
squirrel at WPI.EDU
Fri Aug 6 15:38:35 EDT 2004
On Fri, 6 Aug 2004, John Roth wrote:
> I think it's possible to do prototypes within Python by
> overriding the __getattribute__() magic method. It still
> wouldn't be very pretty, but it should be able to do
> everything except override the magic methods (those
> seem to have to be in the class object for new style
> classes).
Hm, I'd never thought of this before; something along the lines of:
class derive(object):
def __init__(self,parent):
self.parent = parent
def __getattribute__(self,attr):
return getattr(self.parent,attr)
myderivedobject = derive(myprototypeobject)
would do the trick quite nicely I guess. I have one application that
could benefit quite nicely from prototypes; I'll see if I can't work this
in. Thanks for the enlightenment!
More information about the Python-list
mailing list