<p>If I create a class <code>A</code> as follows:</p>

<pre><code>class A:
    def __init__(self):
        self.name = 'A'
</code></pre>

<p>Inspecting the <code>__dict__</code> member looks like <code>{'name': 'A'}</code></p>

<p>If however I create a class <code>B</code>:</p>

<pre><code>class B:
    name = 'B'
</code></pre>

<p><code>__dict__</code> is empty.</p>

<p>What is the difference between the two, and why doesn't <code>name</code> show up in <code>B</code>'s <code>__dict__</code>?</p>

```
B.name
```
is a class attribute, not an instance attribute.  It shows up in
```
B.__dict__
```
, but not in
```
b = B(); b.__dict__
```
.
The distinction is obscured somewhat because when you access an attribute on an instance, the class dict is a fallback.  So in the above example,
```
b.name
```
will give you the value of
```
B.name
```
.