Skip to content

Commit c526823

Browse files
committed
src/conway_polynomials/__init__.py: use tuples for coefficients
The "list" of coefficients is homogeneous (of type int), so a tuple is more appropriate than a list.
1 parent 7e587b7 commit c526823

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/conway_polynomials/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
1616
>>> p = 2; n = 5
1717
>>> cpdb[p][n]
18-
[1, 0, 1, 0, 0, 1]
18+
(1, 0, 1, 0, 0, 1)
1919
2020
>>> p = 2; n = 17
2121
>>> cpdb[p][17]
22-
[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
22+
(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
2323
2424
"""
2525

@@ -28,7 +28,7 @@ def _parse_line(l):
2828
r"""
2929
Parse a single line (not the first or the last) from Frank
3030
Lübeck's data file into a triplet (p, n, coeffs), where ``p`` and
31-
``n`` are python integers and ``coeffs`` is a list of
31+
``n`` are python integers and ``coeffs`` is a tuple of
3232
them. According to Frank's webpage, each line has the form,
3333
3434
[p, n, [a0, a1, ..., 1]],
@@ -46,7 +46,7 @@ def _parse_line(l):
4646
# Convert everything to integers before returning.
4747
p = int(fields[0])
4848
n = int(fields[1])
49-
coeffs = [int(c) for c in fields[2:]]
49+
coeffs = tuple( int(c) for c in fields[2:] )
5050

5151
return (p, n, coeffs)
5252

@@ -59,7 +59,7 @@ def database():
5959
6060
The returned dictionary is of the form ``{p => {n => coeffs}}``,
6161
where ``p`` is a prime, ``n`` is a degree, and ``coeffs`` is a
62-
list of coefficients. The coefficients are listed in "ascending"
62+
tuple of coefficients. The coefficients are listed in "ascending"
6363
order, i.e. they are indexed by the degree of the monomial they
6464
sit in front of.
6565

0 commit comments

Comments
 (0)