t185.py 292 B

1234567891011121314
  1. class Wee:
  2. def __init__(self):
  3. self.called = False
  4. def __iter__(self):
  5. return self
  6. def next(self):
  7. print "in next"
  8. if not self.called:
  9. self.called = True
  10. return "dog"
  11. raise StopIteration
  12. for i in Wee():
  13. print i