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
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
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__.
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.
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
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