class OddIterator(object): def __init__(self): self.value = -1 # Required for the for-in syntax def __iter__(self): return self # Returns the next value of the iterator def next(self): self.value += 2 return self.value #//python/8031