t183.py 216 B

123456789101112131415
  1. def yrange(n):
  2. for i in range(n):
  3. yield i
  4. def creator():
  5. r = yrange(5)
  6. print "creator", r.next()
  7. return r
  8. def caller():
  9. r = creator()
  10. for i in r:
  11. print "caller", i
  12. caller()