examples/generators/generator_counter_3.py
from __future__ import print_function

def counter():
    n = 1
    yield n

    n += 1
    yield n

    n += 1
    yield n

for c in counter():
    print(c)
# 1
# 2
# 3