Subclass dynamically

Sergey Simonenko gforgx at lavabit.com
Wed Aug 19 05:18:37 EDT 2009


On Sat, 08 Aug 2009 11:12:30 -0600, Robert Dailey <rcdailey at gmail.com>  
wrote:

How can you subclass a class from an object?..

> Hey,
>
> I have a class that I want to have a different base class depending on
> a parameter that I pass to its __init__method. For example
> (pseudocode):
>
> class MyDerived( self.base ):
>   def __init__( self, base ):
>     self.base = base
>
>
> Something like that... and then I would do this:
>
> foo = MyDerived( MyBase() )
>
> Note I'm using Python 3.1 on Windows. Thanks in advance.


-- 
Kind regards, Sergey Simonenko.




More information about the Python-list mailing list