MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / Counter

Class Counter

09_iterators/python/iterators.py:1–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Counter:
2 def __init__(self):
3 self.count = 0
4
5 def __iter__(self):
6 return self
7
8 def __next__(self):
9 if self.count < 5:
10 self.count += 1
11 return self.count
12 raise StopIteration
13
14
15if __name__ == '__main__':

Callers 1

iterators.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected