diff options
| author | Florent Monjalet <florent.monjalet@gmail.com> | 2015-10-15 10:09:09 +0200 |
|---|---|---|
| committer | Florent Monjalet <florent.monjalet@gmail.com> | 2015-10-15 10:12:11 +0200 |
| commit | cb5b9fc9d55b396ddfd6b4930197cb6d9398117c (patch) | |
| tree | 01ccfb163708f2433a8d44ba046f39ac65bbf1a7 | |
| parent | c9189eb28272bcf55599330b36521afd1f20d47f (diff) | |
| download | miasm-cb5b9fc9d55b396ddfd6b4930197cb6d9398117c.tar.gz miasm-cb5b9fc9d55b396ddfd6b4930197cb6d9398117c.zip | |
BoundedDict: better dict syntax
| -rw-r--r-- | miasm2/core/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/miasm2/core/utils.py b/miasm2/core/utils.py index b34ec971..75eb3113 100644 --- a/miasm2/core/utils.py +++ b/miasm2/core/utils.py @@ -75,7 +75,7 @@ class BoundedDict(UserDict.DictMixin): self._max_size = max_size self._size = len(self._data) # Do not use collections.Counter as it is quite slow - self._counter = dict((k, 1) for k in self._data.iterkeys()) + self._counter = {k: 1 for k in self._data} self._delete_cb = delete_cb def __setitem__(self, asked_key, value): @@ -99,7 +99,7 @@ class BoundedDict(UserDict.DictMixin): self._size = self._min_size # Reset use's counter - self._counter = dict((k, 1) for k in self._data.iterkeys()) + self._counter = {k: 1 for k in self._data} # Avoid rechecking in dict: set to 1 here, add 1 otherwise self._counter[asked_key] = 1 |