Mercurial > pylearn
diff lookup_list.py @ 71:5b699b31770a
merge
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Fri, 02 May 2008 18:19:35 -0400 |
parents | a5c70dc42972 |
children | 427e02ef0629 |
line wrap: on
line diff
--- a/lookup_list.py Fri May 02 18:19:15 2008 -0400 +++ b/lookup_list.py Fri May 02 18:19:35 2008 -0400 @@ -46,9 +46,11 @@ The key in example[key] can either be an integer to index the fields or the name of the field. """ - if isinstance(key,int): + if isinstance(key,int) or isinstance(key,slice) or isinstance(key,list): return self._values[key] else: # if not an int, key must be a name + # expecting key to be a valid field name + assert isinstance(key,str) return self._values[self._name2index[key]] def __setitem__(self,key,value):