difference when using dot syntax with ClassName or self
<p>When accessing class attributes, what is the difference when using the class name <code>Foo</code> or <code>self</code> within that classes methods?</p>

<pre><code>&gt;&gt;&gt; class Foo(object):
...     class_attribute = "Oh Hai"
...     def bar(self):
...         print(Foo.class_attribute)
...         print(self.class_attribute)
...
&gt;&gt;&gt; Foo().bar()
Oh Hai
Oh Hai
</code></pre>

<p>Both work. In both cases I assume Python looks at the instance of the class and doesn't find the class attributes bound to it so then it proceeds to check the class attributes and find <code>class_attribute</code>.</p>

<p>Is one more efficient than the other?</p>

<p>Is it just a personal preference for code readability? To me seeing <code>ClassName.class_attribute</code> used <em>within</em> that class looks odd.</p>