SHARE
TWEET

Untitled

a guest Sep 7th, 2012 22 Never
  1. >>> gen = ((yield)+(yield) for _ in range(2))
  2. >>> gen.next()
  3. >>> gen.send(100)
  4. >>> gen.send(200)
  5. 300
  6. >>> gen.next()
  7. >>> gen.send(500)
  8. >>> gen.send(120)
  9. 620
  10. >>> gen.next()
  11.  
  12. Traceback (most recent call last):
  13.   File "<pyshell#113>", line 1, in <module>
  14.     gen.next()
  15. StopIteration
  16. >>>
RAW Paste Data
Top