changeset 153:71107b0ac860

optimization
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 12 May 2008 16:12:29 -0400
parents 39bb21348fdf
children f8a1ae7eb83e
files dataset.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):
   """