title: Python increment value in function call
body: <p>So I've been exploring threading, and I was wondering if there's a analog to ++ in python like c. Essentially, I want to call a thread and as the thread is called, increment a value. So an analogue of <code>thread.start_new_thread(function, (variable++,))</code></p>
  
  <p>I looked for other questions, and I kinda doubt this is possible, but any help is appreciated. </p>
  
  <p>The specific code I'm playing with is this:</p>
  
  <pre><code>import thread
  
  def isprime(x):
  global list
  for i in range(3, x-1,2):
      if x % i == 0:
          return
  print x
  list.append(x)
  
  
  n = 1000000
  i=3
  list = [2]
  while i &lt; n:
      try:
          thread.start_new_thread(isprime,(i,))
          i+= 2
      except:
          pass
  
  print sorted(list)
  
  print len(list)
  </code></pre>