fork download
  1. # your code goes here#!/usr/bin/env python3
  2.  
  3. class Obj():
  4. def __init__(self, word):
  5. self.word = word
  6.  
  7. def __iter__(self):
  8. for l in self.word:
  9. yield l
  10.  
  11. obj = Obj('sergey')
  12. it = iter(obj)
  13.  
  14. print(next(it))
  15. print(next(it))
  16. print(next(it))
  17. print(next(it))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
s
e
r
g