Re: [Tutor] super and __init__ methods

2015-11-27 Thread Ben Finney
Sunil Tech writes: > Thanks I got it. Thanks for telling us! You should know that ‘super’ is a topic that confuses even quite experienced Python programmers. It is good to encounter this early, when you can learn about it. See the article “Python’s super() considered super!” https://rhettinger

Re: [Tutor] super and __init__ methods

2015-11-26 Thread Sunil Tech
Thanks I got it. class Cain(Adam): """docstring for Cain""" def __init__(self, age, *args): super(Cain, self).__init__(*args) self.age = age a = Adam('Eve') c = Cain(12, 'Eve') print a.name, c.age, c.name >>> Eve 12 Eve On Fri, Nov 27, 2015 at 12:44 PM, Sunil Tech wrot

[Tutor] super and __init__ methods

2015-11-26 Thread Sunil Tech
class Adam(object): """docstring for Adam""" def __init__(self, name): self.name = name class Cain(Adam): """docstring for Cain""" def __init__(self, age, *args): super(Cain, self).__init__(age, *args) self.age = age a = Adam('Eve') c = Cain(12) print a.n