Ismael Garrido wrote:
Hello

My code is like this:

class Parent:
   def __init__(self, bunch, of, variables):
      self.bunch, self.of, self.variables = bunch, of, variables

class Son(Parent):
def __init__(self, bunch, of, variables, new):
self.bunch, self.of, self.variables, self.new = bunch, of, variables, new


What I want to know is, is there a better way to write Son class? One in which I don't have to copy&paste the parent's init?


yep. call 'Parent.__init__(this, that)' then do 'self.new = new'

def __init__(self, this, that, new):
    Parent.__init__(this, that)
    self.new = new
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to