Getting not derived members of a class

Franz Steinhaeusler franz.steinhaeusler at gmx.at
Mon Aug 1 10:12:12 EDT 2005


Hello NG,

I want to retrieve the members of a class
with a baseclass.
But the problem is, how to get the non derived 
members.

class a:
    def who(self):
        print "who"
    def __init__(self):
        self._a = 3

class b(a):
    def who1(self):
        print "who1"
    def __init__(self):
        a.__init__(self)
        self._b = 4

y=b()

dir (y)
['__doc__', '__init__', '__module__', '_a', '_b', 'who', 'who1']


I need a function which lists only the members of 
the "not derived" class (here class B).

_b
_who1
__init__

How can I achieve this?
With the introspect module or so?

many thanks in advance!
-- 
Franz Steinhaeusler



More information about the Python-list mailing list