title: Should I be using "global" or "self." for class scope variables in Python?
body: <p>Both of these blocks of code work.  Is there a "right" way to do this?</p>
  
  <pre><code>class Stuff:
      def __init__(self, x = 0):
          global globx
          globx = x
      def inc(self):
          return globx + 1
  
  myStuff = Stuff(3)
  print myStuff.inc()
  </code></pre>
  
  <p>Prints "4"</p>
  
  <pre><code>class Stuff:
      def __init__(self, x = 0):
          self.x = x
      def inc(self):
          return self.x + 1
  
  myStuff = Stuff(3)
  print myStuff.inc()
  </code></pre>
  
  <p>Also prints "4"</p>
  
  <p>I'm a noob, and I'm working with a lot of variables in a class.  Started wondering why I was putting "self." in front of everything in sight.</p>
  
  <p>Thanks for your help!</p>