On Feb 25, 10:52 pm, [EMAIL PROTECTED] wrote: > Arnaud Delobelle: > > > In this case why not: > > > def xfib(a=1, b=1): > > while True: > > yield a > > a += b > > yield b > > b += a > > That's a bit less easy to understand than my version, for me. > In my version is easy to see the values of the variables.
I disagree; the generator function has no right to keep a and b to itself. a and b cry out to be function parameters. The user may want to start a fibonacci sequence with any two initial values. IMHO one of the great qualities of Python is that it makes this very easy in most cases. > And using a > longer function name is better. Up to a certain length :-) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list