class MyContainer(Sequence):

    def __init__(self, *data):
        self.data = list(data)

def __getitem__(self, index):
    return self.data[index]

def __len__(self):
    return len(self.data)
c = MyContainer(1, 'two', 3, 4.0)
for i in c:
    pass
How to implement __iter__(self) for a container object (Python)