How to properly create class global variable : <p>Why the following counter does not work, and how to fix it:</p>

<pre><code>class Test():
   def __init__(self):
       self.counter = 0

   def increment(self):
       print counter++
</code></pre>

<p>Thank you.</p>
