On Thu, 08 Jun 2006 21:14:48 -0400,
alf <[EMAIL PROTECTED]> wrote:

> is there any way to tell the class the base class during runtime?

    >>> class A(object):
    >>>     pass
    >>> class B(object):
    >>>     pass
    >>> o = A()
    >>> o.__class__
    <class '__main__.A'>
    >>> o.__class__ = B
    >>> o.__class__
    <class '__main__.B'>

I don't know if that's a good idea.  Maybe this one:

    class A(object):
        pass
    class B(object):
        pass

    if some_function():
        C = A
    else:
        C = B

    class D(C):
        pass

Why do you want to change a class' base class during runtime?

HTH,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to