<p>Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely.   E.g. until I press a certain key or until a time has passed, rather than until a number reaches a certain point? </p>

<p>Also, if it is based on time then is there any way I could just extend the time and start it going from that point again, rather than having to start again from 0? I am aware there is a time module, i just don't know much about it.</p>

As in almost all languages:
```
```
while True:
  # check what you want and eventually break
  print nextValue()
```
```
The second part of your question is more interesting:
Also, if it is based on time then is there anyway I could just extend the time and start it going from that point again rather than having to start again from 0
you can use a
```
yield
```
instead of
```
return
```
in the function
```
nextValue()
```