Lichen

tests/fib.py

1031:aa1826243f0c
5 months ago Paul Boddie Avoid creating zero-length temporary arrays.
     1 class fib:     2     def __init__(self):     3         self.a, self.b = 0, 1     4      5     def next(self):     6         result = self.b     7         self.a, self.b = self.b, self.a + self.b     8         return result     9     10 seq = fib()    11 i = 0    12 while i < 10:    13     print seq.next()    14     i += 1