python figure which properties belong to the child class
<p>I have a python class hierarchy as follows:</p>

<pre><code>class A:
    def __init__(self):
        self.a = 1
        self.b = 2

class B(A):
    def __init__(self):
        super(B, self).__init__()
        self.c = 3
</code></pre>

<p>Now when I do something like:</p>

<pre><code>obj = B()
obj.__dict__
</code></pre>

<p>I get:</p>

<pre><code>{'a': 1, 'b': 2, 'c': 3}
</code></pre>

<p>is it possible to identify which of these properties belong to the parent class or rather which of these properties are of the child only?</p>

<p>For your simple example, you could get the difference in the dict items:</p>

<pre><code>print(obj.__dict__.items() - A().__dict__.items())
</code></pre>

<p>I suppose we should at least to it without knowing the name of the parent class:</p>

<pre><code> print(obj.__dict__.items() - obj.__class__.__bases__[0]().__dict__.items())
</code></pre>

python class python-3.x