Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 24020fe

Browse files
committed
Partition().to_exp() should return Sage Integers
1 parent 6996fd8 commit 24020fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/sage/combinat/partition.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3101,11 +3101,16 @@ def to_exp(self, k=0):
31013101
[1, 2, 1]
31023102
sage: Partition([3,2,2,1]).to_exp(5)
31033103
[1, 2, 1, 0, 0]
3104+
3105+
TESTS::
3106+
3107+
sage: [parent(x) for x in Partition([3,2,2,1]).to_exp(5)]
3108+
[Integer Ring, Integer Ring, Integer Ring, Integer Ring, Integer Ring]
31043109
"""
31053110
p = self
31063111
if len(p) > 0:
31073112
k = max(k, p[0])
3108-
a = [ 0 ] * (k)
3113+
a = [ZZ.zero()] * k
31093114
for i in p:
31103115
a[i-1] += 1
31113116
return a

0 commit comments

Comments
 (0)