Chris Angelico writes:
> On Fri, Apr 6, 2012 at 2:50 AM, yag wrote:
>>
[snipped 19 lines]
> In each case, you are overriding the foo() method, so your instance
> will only execute the last one. If you want to chain to the others,
> you need to write your methods to do so - which is what you've
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
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
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
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
delivered to yagn...@cyberthink.com.
Thanks and Regards,
Yagnesh
--
http://mail.python.org/mailman/listinfo/python-list
delivered to yagn...@cyberthink.com.
Thanks and Regards,
Yagnesh
--
http://mail.python.org/mailman/listinfo/python-list