Skip to content

Commit

Permalink
Use 'yield from' directly instead of yielding each element one by one
Browse files Browse the repository at this point in the history
  • Loading branch information
akosthekiss committed Aug 26, 2024
1 parent fc08d99 commit 38a4ed7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions picire/iterator.py
Original file line number Diff line number Diff line change
@@ -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
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 38a4ed7

Please sign in to comment.