unbounded generator, creates Fibonacci sequence
()
| 2 | |
| 3 | # needs Python 2.2 or above! |
| 4 | def fib(): |
| 5 | "unbounded generator, creates Fibonacci sequence" |
| 6 | x = 0 |
| 7 | y = 1 |
| 8 | while 1: |
| 9 | x, y = y, x + y |
| 10 | yield x |
| 11 | |
| 12 | |
| 13 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected