summaryrefslogtreecommitdiff
path: root/python/m5/smartdict.py
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2005-03-16 10:49:42 -0500
committerLisa Hsu <hsul@eecs.umich.edu>2005-03-16 10:49:42 -0500
commitbc6baa4049c285322fd0601a88c352fda1996dc1 (patch)
treea25c84a48af9185b06f5166ac386f8cedcdf3e3d /python/m5/smartdict.py
parent650306d5e5119e54190ce342e0b7afc182cd3c08 (diff)
parentd80522183992207132e638ce2bb02513758bb61f (diff)
downloadgem5-bc6baa4049c285322fd0601a88c352fda1996dc1.tar.xz
Merge zizzer:/bk/m5
into zizzer.eecs.umich.edu:/.automount/zed/z/hsul/work/m5/pact05 --HG-- extra : convert_revision : e7ff23f6ac4e434d8b3117275df12fec03964a55
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'))