summaryrefslogtreecommitdiff
path: root/python/m5
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-03-15 19:41:51 -0500
committerSteve Reinhardt <stever@eecs.umich.edu>2005-03-15 19:41:51 -0500
commit42753edb3c93cbc2ef7a6698b88b20bd641122fe (patch)
tree0974d8c8b900b8dd6bb818eb296fa90d21cfcc21 /python/m5
parent6aaa9a7d63d4a11746ebd11332355a80d031dbb0 (diff)
downloadgem5-42753edb3c93cbc2ef7a6698b88b20bd641122fe.tar.xz
Add a comment to smartdict.py.
python/m5/smartdict.py: Add a comment explaining why this actually works. --HG-- extra : convert_revision : 39cbde547f4bf6cf626ab1c0b6ef56a5788b09b8
Diffstat (limited to 'python/m5')
-rw-r--r--python/m5/smartdict.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/m5/smartdict.py b/python/m5/smartdict.py
index 4ea8210d3..1ba5d8410 100644
--- 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'))