Subclass dynamically

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Aug 19 09:43:38 EDT 2009


Robert Dailey a écrit :
> 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() )


What is your real use case ? I mean, what problem are you actually 
trying to solve this way ?




More information about the Python-list mailing list