# HG changeset patch # User Frederic Bastien # Date 1210623149 14400 # Node ID 71107b0ac860bc8a1ebbae911df593e51c9361a4 # Parent 39bb21348fdfb5c593f211d5ed4cded9907d3fe9 optimization diff -r 39bb21348fdf -r 71107b0ac860 dataset.py --- a/dataset.py Mon May 12 15:51:43 2008 -0400 +++ b/dataset.py Mon May 12 16:12:29 2008 -0400 @@ -1083,6 +1083,11 @@ return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) return CacheIterator(self) + def __getitem__(self,i): + if type(i)==int and len(self.cached_examples)>i: + return self.cached_examples[i] + else: + return DataSet.__getitem__(self,i) class ApplyFunctionDataSet(DataSet): """