#required iterable elements class MyIterator(object): def __iter__(self): return self.data.__iter__() def __len__(self): return len(self.data) def __contains__(self, v): return v in self.data def __getitem__(self, v): return self.data[v]
Tuesday, October 9, 2007
Required methods to make a class iterable
Really useful:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment