I try to influence a generator at runtime. The code works using a global, I am asking for a *more pythonic way* to achive the same result.

This example prints out hour and minute for a time range. The range from 13:15 to 15:45 should be skipped (this is an example, in the real world the decision to skip some values is not fixed)

Can I pass the *globalskiptime* to the generator some better way?

```
import datetime

globalskiptime = None

def mynexttime(mystart=None):
    # returns 15 30 45 59 minute for each hour
    for myhour in range(0, 24):
        for myminute in range(15, 61, 15):
            if mystart is not None:
                if datetime.time(myhour, myminute
                                 if myminute < 60 else 59) < mystart:
                    continue
            if globalskiptime is not None:
                if datetime.time(myhour, myminute
                                 if myminute < 60 else 59) < globalskiptime:
                    continue
            yield myhour, myminute if myminute < 60 else 59

mystarttime = datetime.time(10, 45)

print type(mystarttime) is datetime.time

for h, m in mynexttime(mystarttime):
    print(str(h) + " " + str(m))
    if h == 13:
        print('skip until 15:45')
        globalskiptime = datetime.time(15, 45)

```