class indexer: def __getitem__(self, index): return index ** 2 X = indexer( ) X[2] for i in range(5): print X[i],