diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-12-20 10:46:53 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-12-21 17:18:39 -0800 |
commit | e6fbfd5aab0d8fd9873ebe04f318180287872285 (patch) | |
tree | 8f000a71d388a2a803a5b02e4f870dadb4e6a988 /alot/widgets | |
parent | 751b4fa7220f826e6ce1019cc332dbbbb0a7c79b (diff) |
Use dict's iter methods
This patch replaces a number of uses of dict.items, dict.values, and
dict.keys with their iterative siblings. The advantage of using the
iterator version is that they don't copy the keys, values, or items, but
simply return references. This reduces memory usage and may speed up the
these operations a bit.
Diffstat (limited to 'alot/widgets')
-rw-r--r-- | alot/widgets/globals.py | 2 | ||||
-rw-r--r-- | alot/widgets/thread.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/alot/widgets/globals.py b/alot/widgets/globals.py index 81b14b70..b4fae0c8 100644 --- a/alot/widgets/globals.py +++ b/alot/widgets/globals.py @@ -51,7 +51,7 @@ class ChoiceWidget(urwid.Text): self.separator = separator items = [] - for k, v in choices.items(): + for k, v in choices.iteritems(): if v == select and select is not None: items += ['[', k, ']:', v] else: diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index a0aa16d3..9b8d029d 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -276,7 +276,7 @@ class MessageTree(CollapsibleTree): if headers is None: # collect all header/value pairs in the order they appear headers = mail.keys() - for key, value in mail.items(): + for key, value in mail.iteritems(): dvalue = decode_header(value, normalize=normalize) lines.append((key, dvalue)) else: |