Mercurial > pylearn
comparison lookup_list.py @ 20:266c68cb6136
Minor editions, plus adding untested ApplyFunctionDataset for GradientLearner in the works.
author | bengioy@bengiomac.local |
---|---|
date | Mon, 07 Apr 2008 09:48:39 -0400 |
parents | 57f4015e2e09 |
children | b6b36f65664f |
comparison
equal
deleted
inserted
replaced
19:57f4015e2e09 | 20:266c68cb6136 |
---|---|
53 try: | 53 try: |
54 return self._values[self._name2index[name]] | 54 return self._values[self._name2index[name]] |
55 except KeyError, e: | 55 except KeyError, e: |
56 raise AttributeError(name) | 56 raise AttributeError(name) |
57 | 57 |
58 if 0: | |
59 # This makes subclassing horrible, just call append_keyval if it's | |
60 # really what you want to do. | |
61 # -JB | |
62 def __setattr__(self,name,value): | |
63 if name in self._name2index: | |
64 self._values[self._name2index[name]]=value | |
65 else: | |
66 raise AttributeError(name) | |
67 | |
68 def append_keyval(self, key, value): | 58 def append_keyval(self, key, value): |
69 self._name2index[key]=len(self) | 59 self._name2index[key]=len(self) |
70 self._values.append(value) | 60 self._values.append(value) |
71 self._names.append(key) | 61 self._names.append(key) |
72 | 62 |