mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
finished iterators chapter
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
"""Fibonacci iterator"""
|
||||
|
||||
class Fib:
|
||||
"""iterator that yields numbers in the Fibanocci sequence"""
|
||||
|
||||
def __init__(self, max):
|
||||
self.max = max
|
||||
|
||||
def __iter__(self):
|
||||
self.a, self.b = 0, 1
|
||||
self.a = 0
|
||||
self.b = 1
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
|
||||
Reference in New Issue
Block a user