Skip to content

Commit 4c5a738

Browse files
30751 iteration over infinite groups
1 parent e2433f6 commit 4c5a738

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/sage/groups/abelian_gps/abelian_group.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,14 +1314,13 @@ def __iter__(self):
13141314
invs = self.gens_orders()
13151315
if 0 not in invs:
13161316
# The group is finite
1317-
for t in mrange(invs):
1318-
yield self(t)
1317+
yield from map(self, mrange(invs))
13191318
else:
13201319
# A similar approach works for infinite groups.
13211320
# (This would also work for finite groups, but is more complicated.)
13221321
from sage.misc.mrange import cantor_product
1323-
for t in cantor_product(*[range(n) if n > 0 else ZZ for n in invs]):
1324-
yield self(t)
1322+
yield from map(self, cantor_product(*[range(n) if n
1323+
else ZZ for n in invs]))
13251324

13261325
def number_of_subgroups(self, order=None):
13271326
r"""

0 commit comments

Comments
 (0)