Re: Override method name and original method access

2007-11-13 Thread Gabriel Genellina
En Tue, 13 Nov 2007 17:14:07 -0300, Chris Mellon <[EMAIL PROTECTED]> escribió: > On Nov 13, 2007 3:00 AM, Gabriel Genellina <[EMAIL PROTECTED]> > wrote: >> You may prefer keeping your old-style classes and avoid using >> super, if you don't have multiple inheritance. Just call explicitely the

Re: Override method name and original method access

2007-11-13 Thread Donn Ingle
Chris Mellon wrote: > The use of super() > (and new style classes) should be the default implementation, To get some clarity on this subject, how do I make sure my classes are "new"? I've got the idea that my hierarchy must start from a base-class that explicitly derives from Object and not . I'

Re: Override method name and original method access

2007-11-13 Thread Chris Mellon
On Nov 13, 2007 3:00 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 13 Nov 2007 01:45:31 -0300, Donn Ingle <[EMAIL PROTECTED]> > escribió: > > >> You need to be a new-style class (that is, you must inherit from > >> object) for super() to work. > > Problem is that my classes inherit alr

Re: Override method name and original method access

2007-11-13 Thread Donn Ingle
> One.add(self, otherstuff) Ah! Thanks - that makes more sense. Much appreciated. /d -- http://mail.python.org/mailman/listinfo/python-list

Re: Override method name and original method access

2007-11-13 Thread Gabriel Genellina
En Tue, 13 Nov 2007 01:45:31 -0300, Donn Ingle <[EMAIL PROTECTED]> escribió: >> You need to be a new-style class (that is, you must inherit from >> object) for super() to work. > Problem is that my classes inherit already, from others I wrote. So, > should > I explicitly put (object) into the

Re: Override method name and original method access

2007-11-12 Thread Donn Ingle
> You need to be a new-style class (that is, you must inherit from > object) for super() to work. Problem is that my classes inherit already, from others I wrote. So, should I explicitly put (object) into the ones at the top? > Other than that, you are using it > correctly here. Well, even with

Re: Override method name and original method access

2007-11-12 Thread Laszlo Nagy
Donn Ingle wrote: > In an unusual twist of code I have a subclass which overrides a method but > it also needs to call the original method: > > class One: > def add (self, stuff): > self.stuff.append(stuff) > > class Two(One): > def __init__(self, otherstuff): > (otherstuff) #otherstuff must

Re: Override method name and original method access

2007-11-12 Thread Chris Mellon
On Nov 12, 2007 1:41 PM, Donn Ingle <[EMAIL PROTECTED]> wrote: > In an unusual twist of code I have a subclass which overrides a method but > it also needs to call the original method: > > class One: > def add (self, stuff): > self.stuff.append(stuff) > > class Two(One): > def __init__(self, ot

Override method name and original method access

2007-11-12 Thread Donn Ingle
In an unusual twist of code I have a subclass which overrides a method but it also needs to call the original method: class One: def add (self, stuff): self.stuff.append(stuff) class Two(One): def __init__(self, otherstuff): (otherstuff) #otherstuff must go into list within the parent. #Th