diff options
author | Mathieu Bridon <mathieu@hashbang.fr> | 2019-07-23 16:58:27 +0200 |
---|---|---|
committer | Mathieu Bridon <mathieu@hashbang.fr> | 2019-07-23 16:58:27 +0200 |
commit | 527bcf74aa2f2cfbf13f2e3af46ffb3819f08141 (patch) | |
tree | 492ec0d22111b55b98a7c6425d0e6c93a8acf4d8 | |
parent | 55fe93eb86df329ab6dbb06612dcb67330e55362 (diff) | |
download | pygobject-527bcf74aa2f2cfbf13f2e3af46ffb3819f08141.tar.gz |
variant: Create a tuple directly
This avoids iterating twice: once to create the list with a
list-comprehension and a second time to transform that list into a
tuple.
-rw-r--r-- | gi/overrides/GLib.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py index 83cbb7fb..78d309b6 100644 --- a/gi/overrides/GLib.py +++ b/gi/overrides/GLib.py @@ -246,9 +246,8 @@ class Variant(GLib.Variant): # tuple if type_string.startswith('('): - res = [self.get_child_value(i).unpack() - for i in range(self.n_children())] - return tuple(res) + return tuple(self.get_child_value(i).unpack() + for i in range(self.n_children())) # dictionary if type_string.startswith('a{'): |