title: Spawning functions asynchronously using Gevents
body: <p>I was undergoing Gevents ( python library for asych functionality ) and wrote a very small program to understand how it works , but the results were quite baffling. 
  The below is the code </p>
  
  <pre><code>import gevent 
  import time 
  
  
  def mytime(t):
      time.sleep(t)
      print " i have slept for ",t,"secs"
  
  x = range (0,10)
  x.reverse()
  
  for i in x :
      jobs = [ gevent.spawn(mytime , i) ] 
  gevent.joinall(jobs)
  </code></pre>
  
  <p>The output no matter how many times i run  , i get </p>
  
  <pre><code> i have slept for  9 secs
   i have slept for  8 secs
   i have slept for  7 secs
   i have slept for  6 secs
   i have slept for  5 secs
   i have slept for  4 secs
   i have slept for  3 secs
   i have slept for  2 secs
   i have slept for  1 secs
   i have slept for  0 secs
  </code></pre>
  
  <p>There is a similar example , presented as a part of gevent <a href="http://sdiehl.github.com/gevent-tutorial/">tutorials</a>. </p>
  
  <p>where the asynch functionality is pretty apparent . All i have done is to add a sleep functionality in the code.  shouldnt the output be something like this ??</p>
  
  <pre><code>     i have slept for  6 secs
       i have slept for  8 secs
       i have slept for  5 secs
       i have slept for  9 secs
       i have slept for  7 secs
       i have slept for  0 secs
       i have slept for  3 secs
       i have slept for  2 secs
       i have slept for  1 secs
       i have slept for  4 secs
  </code></pre>