19
I'm implementing what is essentially a container object (although it does have a little of it's own logic). I want to be able to iterate over items in a field in this class (which is just a plain list). Should I re-implement __iter__ and next for my class or is it acceptable to return the iterator of the list, like so:
class X:
def __init__(self):
self.list = []
def __iter__(self):
return self.list.__iter__()
I'm a little unsure if this will lead to any undesirable behavior.