Skip to content

Commit 7271bd0

Browse files
author
Release Manager
committed
gh-40833: various details in coding mostly about code simplification after suggestions of ruff also some typing annotations ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40833 Reported by: Frédéric Chapoton Reviewer(s): Vincent Macri
2 parents 4f0a728 + fb57bf6 commit 7271bd0

File tree

5 files changed

+73
-104
lines changed

5 files changed

+73
-104
lines changed

src/sage/coding/golay_code.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,7 @@ def minimum_distance(self):
191191
sage: C.minimum_distance()
192192
8
193193
"""
194-
n = self.length()
195-
if n == 24:
196-
return 8
197-
elif n == 23:
198-
return 7
199-
elif n == 12:
200-
return 6
201-
elif n == 11:
202-
return 5
194+
return {24: 8, 23: 7, 12: 6, 11: 5}[self.length()]
203195

204196
def covering_radius(self):
205197
r"""
@@ -227,15 +219,7 @@ def covering_radius(self):
227219
sage: C.covering_radius()
228220
2
229221
"""
230-
n = self.length()
231-
if n == 23:
232-
return 3
233-
elif n == 24:
234-
return 4
235-
elif n == 11:
236-
return 2
237-
elif n == 12:
238-
return 3
222+
return {23: 3, 24: 4, 11: 2, 12: 3}[self.length()]
239223

240224
def weight_distribution(self):
241225
r"""

0 commit comments

Comments
 (0)