def taxi_process(ident, trips, start_time=0):  # <1>
    time = yield Event(start_time, ident, 'leave garage')  # <2>
    for i in range(trips):  # <3>
        time = yield Event(time, ident, 'pick up passenger')  # <4>
        time = yield Event(time, ident, 'drop off passenger')  # <5>

    yield Event(time, ident, 'going home')  # <6>
    # end of taxi process # <7>
# END TAXI_PROCESS


# BEGIN TAXI_SIMULATOR
Yield to simulator issuing event at each state change
dataset/ETHPy150Open fluentpython/example-code/16-coroutine/taxi_sim_delay.py/taxi_process