Graham Fawcett:

> def fibonacci():
>     a, b = 1, 1
>     while True:
>         yield a
>         a, b = b, a + b

This is my version I use (doctests and docstring removed), a bit faster with 
Python 2.x:

def xfibonacci():
    a, b = 0, 1
    while 1:
        yield b
        a += b
        yield a
        b += a

Thank you for your explanations. I am too much ignorant still to talk about 
those things :-)

Bye,
bearophile

Reply via email to