examples/classes/fibonacci.py
class Fibonacci(object):
    def __init__(self):
        self.values = []
    def __iter__(self):
        return self
    def next(self):
        if len(self.values) == 0:
            self.values.append(1)
            return 1
        if len(self.values) == 1:
            self.values.append(1)
            return 1
        self.values.append(self.values[-1] + self.values[-2])
        return self.values[-1]
examples/classes/fib.py
import fibonacci
f = fibonacci.Fibonacci()
print(f)
for v in f:
    print(v)
    if v > 10:
        break