projects
/
gem5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6aaa9a7
)
Add a comment to smartdict.py.
author
Steve Reinhardt
<stever@eecs.umich.edu>
Wed, 16 Mar 2005 00:41:51 +0000
(19:41 -0500)
committer
Steve Reinhardt
<stever@eecs.umich.edu>
Wed, 16 Mar 2005 00:41:51 +0000
(19:41 -0500)
python/m5/smartdict.py:
Add a comment explaining why this actually works.
--HG--
extra : convert_revision :
39cbde547f4bf6cf626ab1c0b6ef56a5788b09b8
python/m5/smartdict.py
patch
|
blob
|
history
diff --git
a/python/m5/smartdict.py
b/python/m5/smartdict.py
index 4ea8210d361cf2bc760d13f871c2ee8b2cc26a8c..1ba5d8410b773b30afd2cb7ea8254d3347b35ca4 100644
(file)
--- a/
python/m5/smartdict.py
+++ b/
python/m5/smartdict.py
@@
-74,6
+74,12
@@
class SmartDict(dict):
return other / self.convert(other)
+ # __getitem__ uses dict.get() to return 'False' if the key is not
+ # found (rather than raising KeyError). Note that this does *not*
+ # set the key's value to 'False' in the dict, so that even after
+ # we call env['foo'] we still get a meaningful answer from "'foo'
+ # in env" (which calls dict.__contains__, which we do not
+ # override).
def __getitem__(self, key):
return self.Proxy(dict.get(self, key, 'False'))