title: It is possible to create an int variable in Python outside class?
body: <p>I am new to Python and I am trying to use Flask to build a simple REST-API. I want to count how many lists are recieved from <code>post</code> method. To make it simple, I have this situation:</p>
  <pre><code>#imports to use Flask and json...
  
  myList = list ()
  myInt = int()
  
  class MyResource(Resource):
      def post(self):
          # Reciving JSON and parsing it to a list
          myList = json.loads(recivedJSON)
          myInt += 1
          # other method stuff...
  </code></pre>
  <p>While I can use <code>myList</code> without a single warning, when I try to increment <code>myInt</code>, appears the error:</p>
  <pre><code>Unresolved refercence 'myInt'
  </code></pre>
  <p>I tried to instatiate <code>myInt</code> inside <code>MyResource</code> and then calling it by <code>self.myInt</code>. In order to understand what is going on, I increment <code>myInt</code> and then print it.</p>
  <pre><code>#imports to use Flask and json... 
  
  myList = list ()
  
  class MyResource(Resource):
     myInt = int()
  
      def post(self):
          # Reciving JSON and parsing it to a list
          myList = json.loads(recivedJSON)
          self.myInt += 1
          print(self.myInt)
          # other method stuff...
  </code></pre>
  <p>In this way, the error doesn't show up but every time I invoke the <code>post</code> method, the <code>print</code> output of <code>myInt</code> is 1. It means that <code>myInt</code> is always 0 foreach <code>post</code> invoking.</p>
  <p>How can I fix that ?</p>