Paste Search Dynamic
Recent pastes
MyNumbers
  1. class MyNumbers:
  2.   def __iter__(self):
  3.     self.a = 1
  4.     return self
  5.  
  6.   def __next__(self):
  7.     x = self.a
  8.     self.a += 1
  9.     return x
  10.  
  11. myclass = MyNumbers()
  12. myiter = iter(myclass)
  13.  
  14. print(next(myiter))
  15. print(next(myiter))
  16. print(next(myiter))
  17. print(next(myiter))
  18. print(next(myiter))
Parsed in 0.001 seconds