Re: Question about subclassing and overriding methods

2006-09-07 Thread Frank Millman
Dennis Lee Bieber wrote: > On 7 Sep 2006 01:33:30 -0700, "Frank Millman" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > In my particular case, when I do subclass Test, y is always True. > > Therefore I can rewrite it like this - > > > > class Test2(Test): > > def __in

Re: Question about subclassing and overriding methods

2006-09-07 Thread Frank Millman
Bruno Desthuilliers wrote: > Frank Millman wrote: > > This "replacement" happens at instance initialisation time - ie, after > the class object have been created. If you don't want this to happen, > either skip the call to Test.__init__ in Test2.__init__, or make this > call with False as second p

Re: Question about subclassing and overriding methods

2006-09-07 Thread Bruno Desthuilliers
Frank Millman wrote: > Hi all > > Assume a simple class - > > class Test(object): > def __init__(self,x): > self.x = x > def getx(self): > print self.x > > Test(1).getx() > Test(2).getx() > Test(3).getx() > > As expected, the results are 1,2,3 > > Assume a slight variat

Re: Question about subclassing and overriding methods

2006-09-07 Thread Frank Millman
Frank Millman wrote: > Hi all > > Assume a simple class - > > class Test(object): > def __init__(self,x): > self.x = x > def getx(self): > print self.x > > Test(1).getx() > Test(2).getx() > Test(3).getx() > > As expected, the results are 1,2,3 > > Assume a slight variation,

Question about subclassing and overriding methods

2006-09-07 Thread Frank Millman
Hi all Assume a simple class - class Test(object): def __init__(self,x): self.x = x def getx(self): print self.x Test(1).getx() Test(2).getx() Test(3).getx() As expected, the results are 1,2,3 Assume a slight variation, where given a particular condition I want a partic