summaryrefslogtreecommitdiff
path: root/python/m5/smartdict.py
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-03-18 15:32:53 -0500
committerKevin Lim <ktlim@umich.edu>2005-03-18 15:32:53 -0500
commitcfa4221e19459d2179ba5601cf71a7a53753a3b1 (patch)
tree108c984e4fb9ef421557f610c210aa76c4dd70ed /python/m5/smartdict.py
parent363f02a1fd0a8ae8c91152ccde4453b934d7d3d4 (diff)
parent3efabb657948e53462bfe60ca93a2ac147074ea1 (diff)
downloadgem5-cfa4221e19459d2179ba5601cf71a7a53753a3b1.tar.xz
Merge ktlim@zizzer.eecs.umich.edu:/bk/m5
into zamp.eecs.umich.edu:/z/ktlim2/m5 --HG-- extra : convert_revision : cbf8da2fe5c4155d9ed8318597d543ff105449d3
Diffstat (limited to 'python/m5/smartdict.py')
-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'))