PyEuler

Arnaud Delobelle arnodel at googlemail.com
Mon Feb 25 22:24:05 CET 2008


On Feb 25, 7:25 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Are you kidding?
>     def ggenfib():
>       a,b = 1,2
>       while True:
>          yield a
>          a,b = b, a=b

Or:

def genfib(a=0, b=1):
    for a, b in iter(lambda:(b, a+b), None):
        yield a

;-)

Ahem.  I admit that somehow, I am proud of this.

--
Arnaud




More information about the Python-list mailing list