Let's avoid creating an in-memory list of keys and query for each value and use `iteritems` which is an iterator of key-value pairs.
Signed-off-by: Lukáš Doktor <ldok...@redhat.com> Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- scripts/qemu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 66fd863..7e95c25 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -185,11 +185,11 @@ class QEMUMachine(object): def qmp(self, cmd, conv_keys=True, **args): '''Invoke a QMP command and return the result dict''' qmp_args = dict() - for key in args.keys(): + for key, value in args.iteritems(): if conv_keys: - qmp_args[key.translate(self.underscore_to_dash)] = args[key] + qmp_args[key.translate(self.underscore_to_dash)] = value else: - qmp_args[key] = args[key] + qmp_args[key] = value return self._qmp.cmd(cmd, args=qmp_args) -- 2.9.4