Understanding instance and class variable python
<p>Let's suppose I have 2 classes in different scenario.</p>

<p><strong>Scenario 1</strong></p>

<pre><code>class MyClass():
    temp = 5
</code></pre>

<p><strong>Scenario 2</strong></p>

<pre><code>class MyClass():
    temp = 5

    def myfunc(self):
          print self.temp
</code></pre>

<p>Now when will variable <code>temp</code> will be treated as a class variable and instance variable. I am confused because in both the scenarios I am able to access the value of variable <code>temp</code> using both.</p>

<ol>
<li><p><code>Object.Temp</code> (behaving as instance variable) </p></li>
<li><p><code>ClassName.Temp</code> (behaving as class variable)</p></li>
</ol>

<p>I believe similar questions have been asked before but it will be a great help if someone can explain this in context of my question.</p>
