diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-12-14 14:52:01 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-12-21 17:09:25 -0800 |
commit | 68f64472f69a509b4245a0a2ca491a1256100ab9 (patch) | |
tree | 583f28be3c6ec629354460cf16f87acc06fd0d5d /alot/settings | |
parent | 5745e2291fb4d3c81076256d8bc563d50da16da5 (diff) |
Replace map() and filter() with comprehensions
This had the advantage of being more readable to people without a
functional programming background, and it avoids the need to use lambdas
which are both slow and have many corners in python. In a few cases it
also allows us to use a generator expression instead of a materialized
list, which save some memory.
Diffstat (limited to 'alot/settings')
-rw-r--r-- | alot/settings/manager.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py index 392f3535..5718193f 100644 --- a/alot/settings/manager.py +++ b/alot/settings/manager.py @@ -318,8 +318,8 @@ class SettingsManager(object): globalmaps, modemaps = self.get_keybindings(mode) candidates = globalmaps.keys() + modemaps.keys() if prefix is not None: - prefixs = prefix + ' ' - cand = filter(lambda x: x.startswith(prefixs), candidates) + prefixes = prefix + ' ' + cand = [c for c in candidates if c.startswith(prefixes)] if prefix in candidates: candidates = cand + [prefix] else: |