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
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'
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
> One.add(self, otherstuff)
Ah! Thanks - that makes more sense. Much appreciated.
/d
--
http://mail.python.org/mailman/listinfo/python-list
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
> 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
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
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
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