12
I have a class in python, which has an iterable as instance variable. I want to iterate the instances of the class by iterating over the embedded iterable.
I implemented this as follows:
def __iter__(self):
return self._iterable.__iter__()
I don't really feel that comfortable calling the __iter__() method on the iterable, as it is a special method. Is this how you would solve this problem in python or is there a more elegant solution?