title: Class_variable and instance_variable in python
body: <pre><code>class A:
      x=10
      def fn(self):
          print(x)
  </code></pre>
  <p>I tried running this code, but an error comes out as:</p>
  <pre><code>NameError: name 'x' is not defined
  </code></pre>
  <p>inside the function block if i put self.x then it works perfectly
  my doubt is why doesnt the above code work properly
  x is defined in class scope,so shouldnt it be accessable to all functions defined in class as class_variable also</p>