diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-12-20 11:36:26 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-12-21 17:18:39 -0800 |
commit | bf2005c111289fcd7f55b92e64cfa8c43b9bfdbc (patch) | |
tree | e851408464368cfcb173a491a3c4cef5b83888fa /alot/account.py | |
parent | 899d3f4bb20441393182c3a5690566705e6b91aa (diff) |
Don't use dict.keys when not necessary
It's pretty easy to get caught up using dict.keys (or iterkeys) when
one doesn't need to. This patch corrects two cases where it's not
needed, the first is the case of inclusion. ``x in mydict.keys()`` is
equivalent to ``x in mydict``, but without the need to generate a list
and walk it. The second case is when calling set() on a dict,
``set(mydict)`` will create a set object of the dict's keys, without the
need to create one in memory and is significantly faster than
``set(mydict.keys())`` or even ``set(mydict.iterkeys())``.
Diffstat (limited to 'alot/account.py')
0 files changed, 0 insertions, 0 deletions