MCPcopy Index your code
hub / github.com/RustPython/RustPython / Counter

Class Counter

extra_tests/snippets/stdlib_itertools.py:506–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504
505# test infinite iterator
506class Counter(object):
507 def __init__(self, counter=0):
508 self.counter = counter
509
510 def __next__(self):
511 self.counter += 1
512 return self.counter
513
514 def __iter__(self):
515 return self
516
517
518it = zl(Counter(), Counter(3))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected