Performance improvement using in-operator on dicts

Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .keys()
http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
This commit is contained in:
Dag Wieers 2016-11-17 15:19:14 +01:00 committed by Matt Clay
commit 54fdff16db
9 changed files with 10 additions and 10 deletions

View file

@ -1418,7 +1418,7 @@ def state_present(module, existing, proposed, candidate):
commands.append('no {0}'.format(key))
elif value == 'default':
if key in PARAM_TO_DEFAULT_KEYMAP.keys():
if key in PARAM_TO_DEFAULT_KEYMAP:
commands.append('{0} {1}'.format(key, PARAM_TO_DEFAULT_KEYMAP[key]))
elif existing_commands.get(key):