Re: creating a similar object from an derived class

2008-09-03 Thread MRAB
On Sep 3, 8:09 pm, Scott <[EMAIL PROTECTED]> wrote: > Let's say I have an object: > > class foo(): >    def create_another() >        return foo() > >    def blah(): >        x = self.create_another() >        ... do something with X > > Now I create a inherited class of this object: > > class bar(

Re: creating a similar object from an derived class

2008-09-03 Thread Bruno Desthuilliers
Scott a écrit : Let's say I have an object: s/object/class/ class foo(): def create_another() return foo() class Foo(object): def create_another(self): return Foo() def blah(): def blah(self): x = self.create_another() ... do something with X

Re: creating a similar object from an derived class

2008-09-03 Thread Matimus
On Sep 3, 12:09 pm, Scott <[EMAIL PROTECTED]> wrote: > Let's say I have an object: > > class foo(): >    def create_another() >        return foo() > >    def blah(): >        x = self.create_another() >        ... do something with X > > Now I create a inherited class of this object: > > class bar

creating a similar object from an derived class

2008-09-03 Thread Scott
Let's say I have an object: class foo(): def create_another() return foo() def blah(): x = self.create_another() ... do something with X Now I create a inherited class of this object: class bar(foo): ... If I call bar.create_another(), it will return a foo() inst