I am following this: Build a Basic Python Iterator
I have a version of this code, written as a generator function, that works.
Now I want to convert the generator function to a class.
This is what I have:
class Frange(object):
    def __init__(self, value, end=None, step=1.0):
        if end is None:
            self.start, self.end = 0.0, value
            self.step = step
        else:
            self.start = value
            self.end = end
            self.step = step
    def __iter__(self):
        return self
    def __next__(self):
        if self.start < self.end:
            return self.start
for n in Frange(0.5, 2.5, 0.5):
    print(n)
No matter what I try, I can't figure out where\how to implement the step. I either get an infinite stream of objects or 0.5.
I can see in PythonTutor that the init portion is working correctly.
 
    