Possible to fake object type?
Michael 'Mickey' Lauer
mickey at tm.informatik.uni-frankfurt.de
Sat Mar 2 13:03:51 EST 2002
> why not something like that?:
>
> def __getattr__(self, name):
> try:
> return self.__dict__[name]
> except NameError:
> return getattr(gtk.HandleBox, name)
This is basically the same as I have now. But the thing is:
__getattr__ only gets called when the attribute _doesn't_ exist,
which is not very helpful, 'cause they would exist in the baseclass,
which is the reason why I can't simply derive from gtk.HandleBox.
I want to have a class which sends all calls to one of its
attributes but at the same time is derived (or even better
_only_ has the same [fake] type, which my original subject header
implied) from something, which unfortunately has a bundle
of the same methods.
Yours,
:M:
More information about the Python-list
mailing list