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:32:05 +01:00 committed by Matt Clay
commit a417a4f4b3
3 changed files with 12 additions and 12 deletions

View file

@ -196,10 +196,10 @@ class HAProxy(object):
"""
Capture the output for a command
"""
if not 'command' in self.command_results.keys():
if 'command' not in self.command_results:
self.command_results['command'] = []
self.command_results['command'].append(cmd)
if not 'output' in self.command_results.keys():
if 'output' not in self.command_results:
self.command_results['output'] = []
self.command_results['output'].append(output)