I have this class: >>> class A: ... def __init__(self, blank=False, editable=True, name='foo'): ... self.blank = blank ... self.editable = editable ... self.name = name ... >>> a = A() >>> a.blank, a.editable, a.name (False, True, 'foo')
All as expected. Now I want that another class, call it B, inherits all behaviours/attributes except for the attribute blank, that now I want to be False. This should be possible overriding __init__ method no? >>> class B(A): ... def __init__(self, blank=True, editable=True, name='foo'): ... self.blank = blank ... self.editable = editable ... self.name = name ... >>> b = B() >>> b.blank, b.editable, b.name (True, True, 'foo') However, is it possible to achieve this without rewrite the whole __init__ method, but just overriding parts of it? For __init__ very long it would be an unuseful duplication of code.., so I'm sure there is a trivial solution! Can you help to figure it out? Thanks _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor