Generator (computer programming): Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit
Python: type hint
Line 473:
 
<syntaxhighlight lang="python">
def countfrom(n: int) -> Iterator[int]:
while True:
yield n
Line 490:
# Another generator, which produces prime numbers indefinitely as needed.
 
def primes() -> Iterator[int]:
yield 2
n = 3