[solved] Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello, With Chris and Ian help (Thank you both) I end up writing the example script like this,(just for the record) - #! /usr/bin/env python3 # -*- coding: utf-8 -*- class A(object): def __init__(self, a): print('a = ', a) self.a = a

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Chris, Chris Angelico writes: > > If you're subclassing something, you should generally work with the > intention that an instance of your class will function viably in any > situation in which an instance of the parent is wanted. So if you're > writing a method of the same name as one in

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Ian, Yagnesh Raghava Yakkala writes: > Hello Ian, > > Ian Kelly writes: [snipped 21 lines] > >>you will have >> to pass the instance in explicitly as the self argument. For example: > >> B.foo(x) # calls B.foo directly with instance x After follo

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Ian, Ian Kelly writes: > On Thu, Apr 5, 2012 at 10:50 AM, yag wrote: >> three classes A,B,C and instance x. >> >> now how can I call methods foo in class A and B using 'x' instance. (I hope I >> could pronounce the terminology correct) > > Do you mean that you want C.foo to call B.foo, a