From 38a4ed736910a762ed9459024a43d6b3a9c5faba Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Mon, 26 Aug 2024 12:47:36 +0200 Subject: [PATCH] Use 'yield from' directly instead of yielding each element one by one --- picire/iterator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/picire/iterator.py b/picire/iterator.py index 445658c..4029f40 100644 --- a/picire/iterator.py +++ b/picire/iterator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2023 Renata Hodovan, Akos Kiss. +# Copyright (c) 2016-2024 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # . @@ -90,15 +90,13 @@ def __call__(self, n): i=-1..-n to remove subset -i-1). """ if self._subset_first: - for i in self._subset_iterator(n): - yield i + yield from self._subset_iterator(n) for i in self._complement_iterator(n): yield -i - 1 else: for i in self._complement_iterator(n): yield -i - 1 - for i in self._subset_iterator(n): - yield i + yield from self._subset_iterator(n) def __str__(self): def _str(a):