Re: Subclass dynamically

2009-08-19 Thread Bruno Desthuilliers
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

Re: Subclass dynamically

2009-08-19 Thread Piet van Oostrum
> Robert Dailey (RD) wrote: >RD> Hey, >RD> I have a class that I want to have a different base class depending on >RD> a parameter that I pass to its __init__method. For example >RD> (pseudocode): >RD> class MyDerived( self.base ): >RD> def __init__( self, base ): >RD> self.base = base

Re: Subclass dynamically

2009-08-18 Thread Sergey Simonenko
On Sat, 08 Aug 2009 11:12:30 -0600, Robert Dailey 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 _

Re: Subclass dynamically

2009-08-08 Thread Carl Banks
On Aug 8, 12:13 pm, Luis Alberto Zarrabeitia Gomez wrote: > Quoting Robert Dailey : > > > 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): > > 1- Are you sure that you want that behavi

Re: Subclass dynamically

2009-08-08 Thread Luis Alberto Zarrabeitia Gomez
Quoting Robert Dailey : > 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): 1- Are you sure that you want that behavior? Given that in python, a class is just a particular case of invocabl

Re: Subclass dynamically

2009-08-08 Thread Gary Herron
Robert Dailey wrote: 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

Subclass dynamically

2009-08-08 Thread Robert Dailey
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