Re: Get a method instance through 'getattr' but not superclass's method

2010-04-03 Thread Radhakrishna Bhat
thanks. It is working for simple classes. But now i am trying for complex objects. myclassinstance.__class__.dict__ returns dictproxy object at %$^% Looping through the same returned dictproxy gives attributes of superclass. What am i doing wrong? On Fri, Mar 12, 2010 at 12:15 AM, Gabriel

Re: Get a method instance through 'getattr' but not superclass's method

2010-04-03 Thread Gabriel Genellina
Please reply inline; top posting is harder to read. On Fri, Mar 12, 2010 at 12:15 AM, Gabriel Genellina gagsl-...@yahoo.com.arwrote: En Thu, 11 Mar 2010 01:47:30 -0300, Radhakrishna Bhat radhakrishn...@gmail.com escribió: I am using getattr to get a method instance from a class. But it also

Re: Get a method instance through 'getattr' but not superclass's method

2010-03-11 Thread Steve Holden
Radhakrishna Bhat wrote: I am using getattr to get a method instance from a class. But it also returns methods from the superclass. How to detect if an attribute is from superclass? You could try, if x is in instance, looking to see whether the name is defined in x.__class__.__dict__.

Re: Get a method instance through 'getattr' but not superclass's method

2010-03-11 Thread Radhakrishna Bhat
Thanks. I just have to check in that string if method1 is from present in subclass's __dict__ or not. This is important for me because in my code, I am dynamically calling methods of 2 classes where one is superclass of the other. And I was getting duplicate results because of this problem.

Re: Get a method instance through 'getattr' but not superclass's method

2010-03-11 Thread Gabriel Genellina
En Thu, 11 Mar 2010 01:47:30 -0300, Radhakrishna Bhat radhakrishn...@gmail.com escribió: I am using getattr to get a method instance from a class. But it also returns methods from the superclass. How to detect if an attribute is from superclass? You may look it up directly in the class

Get a method instance through 'getattr' but not superclass's method

2010-03-10 Thread Radhakrishna Bhat
I am using getattr to get a method instance from a class. But it also returns methods from the superclass. How to detect if an attribute is from superclass? -Radhakrishna -- http://mail.python.org/mailman/listinfo/python-list