James Henstridge <[EMAIL PROTECTED]> writes:
> On 11 Apr 2001, Bernhard Herzog wrote:
> > However, IIRC, calling a baseclass' method in a method has to be done
> > slightly different. E.g.
> >
> > class MyBox(GtkBaseClass):
> >
> > def __init__(self):
> > GtkBaseClass.__init__(self)
>
> This works with ExtensionClass. ExtensionClass is designed to create
> types that act as much like python classes as possible, so it would be a
> bug if this didn't work.
Well, the ExtensionClass docs contain the following example, which is
actually a bit different (i.e. I did not remember correctly) from the
situation above (taken from the ExtensionClass.stx that comes with Zope
2.3.0:
from ExtensionClass import Base
class Spam:
def __init__(self, name):
self.name=name
class ECSpam(Base, Spam):
def __init__(self, name, favorite_color):
Spam.__init__(self,name)
self.favorite_color=favorite_color
and the docs go on to say:
This implementation will fail when an 'ECSpam' object is
instantiated. The problem is that 'ECSpam.__init__' calls
'Spam.__init__', and 'Spam.__init__' can only be called with a
Python instance (an object of type '"instance"') as the first
argument. The first argument passed to 'Spam.__init__' will be an
'ECSpam' instance (an object of type 'ECSPam').
So at least mixin classes are a bit of a problem with ExtensionClasses
(there's a solution to the problem given in the docs, however). It may
well be that with Python 2.0 this is not an issue anymore.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk