On Jan 24, 9:16 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2008/1/24, William Pursell <[EMAIL PROTECTED]>: > <referring to changing an objects class> > Can I do it in Python? > > > class A(object): pass > class B(object): pass > > a = A() > a.__class__ = B > > That ? Maybe you meant something else.
That is what I was referring to, but it isn't the core functionality that I'm after. (My bad for a poor description.) I'm fairly excited at the idea of being able to do per-object mixins in xotcl. I guess it would look like this in python: BROKEN CODE: a = object() a.__class__.append( foo ) a.__class__.append( bar ) In python, if you want an object to me a member of 2 classes, it seems that you have no choice but to declare a new class that inherits from both. eg: class foobar( foo, bar): pass a = foobar() Is it possible to make an object be a member of 2 classes without defining such a class? I believe "per object mixin" is the correct term for such an animal. The first several google hits on that phrase all reference xotcl, so I'm not sure if that is an xotcl inspired vocabulary that isn't really standard. -- http://mail.python.org/mailman/listinfo/python-list