On Tue, 31 Mar 2009 01:29:50 -0300, Gabriel Genellina wrote:
Oh, and while the gurus are at it, what would be the advantage (if any)
of changing, say
Primate.__init__(self)
to
super(Human, self).__init__()
None, if you use single inheritance everywhere.
But there's no
On Mar 31, 5:13 am, Nick mediocre_per...@hotmail.com wrote:
Oh, and while the gurus are at it, what would be the advantage (if any) of
changing, say
Primate.__init__(self)
to
super(Human, self).__init__()
What others said. In Python 3.0 you would have a bigger advantage,
since you
Thanks for the replies. This has given me some incentive to start looking at
Python 3. Oh, and thanks for the articles on super().
Nick
--
http://mail.python.org/mailman/listinfo/python-list
En Tue, 31 Mar 2009 05:16:47 -0300, Steven D'Aprano
ste...@remove.this.cybersource.com.au escribió:
On Tue, 31 Mar 2009 01:29:50 -0300, Gabriel Genellina wrote:
Oh, and while the gurus are at it, what would be the advantage (if any)
of changing, say
Primate.__init__(self)
to
I've got a collection of classes describing animals, part of which looks
like:
class Animal(object):
def __init__(self):
self.pet = False
self.edible = False
self.legs = 0
self.sound = None
self.name = self.__class__.__name__.lower()
class Mammal(Animal):
En Tue, 31 Mar 2009 00:13:44 -0300, Nick mediocre_per...@hotmail.com
escribió:
I've got a collection of classes describing animals, part of which looks
like:
class Animal(object):
def __init__(self):
self.pet = False
self.edible = False
self.legs = 0
On Mar 31, 1:13 pm, Nick mediocre_per...@hotmail.com wrote:
I want to add a pedigree function to Animal so that I can have:
h = Human()
h.pedigree()
human primate mammal animal
class Animal(object):
@classmethod
def pedigree(cls):
return [c.__name__ for c in cls.mro()