David Ascher wrote:

> Stefan Kuzminski wrote:
> >
> > This is more a general python question, but does anyone know how to modify
> > the inheritance of an object ( an actual instance of an object not the class
> > definition ) at runtime?  i.e.  I have
> >
> > class A:
> >
> > and
> >
> > class B
> >
> > I go along happily..
> >
> > a = A()
> > b = B()
> >
> > now I want b inherit from a, using the objects just created above,  not
> > creating new ones..  I saw this done somewhere ( Webware maybe? ) but I
> > can't find it now.
>
> b.__class__ == A
>
> Simple =)

Wouldn't this make b an instance of class A, though, instead of inheriting from
it?

I *think* (from vague memories) that what would need to be done for inheritance
would be something like:

b.__bases__ == [ A ]

(though you might need to do that on the class B instead of the instance b ... )

Jeff Shannon
Technician/Programmer
Credit International


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to