Jan 26, 2025
Dunder methods are great, but quite often if you need to implement a simple iterator it is easier to use a generator. eg this function replaces the whole class:
```
def myrange(start, end):
current = start
while current < end:
yield current
current += 1
```