From 10c84dfb909187ca8e82a82d8c09772ed21b406c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 20 Sep 2017 08:52:11 +0200 Subject: [PATCH] Use unpacking to access config mutables --- qutebrowser/config/config.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 2a3e79b79..b19a83e73 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -435,7 +435,7 @@ class Config(QObject): # entered the mutable dictionary and thus further copies are unneeded # until update_mutables() is called if name in self._mutables and mutable: - obj = self._mutables[name][1] + _copy, obj = self._mutables[name] # Otherwise, we return a copy of the value stored internally, so the # internal value can never be changed by mutating the object returned. else: @@ -487,9 +487,7 @@ class Config(QObject): Here, we check all those saved copies for mutations, and if something mutated, we call set_obj again so we save the new value. """ - for name in self._mutables: - old_value = self._mutables[name][0] - new_value = self._mutables[name][1] + for name, (old_value, new_value) in self._mutables.items(): if old_value != new_value: log.config.debug("{} was mutated, updating".format(name)) self.set_obj(name, new_value, save_yaml=save_yaml)