Skip to content

Commit 19023d6

Browse files
committed
Apply more suggestions
1 parent 91a833d commit 19023d6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/sage/groups/generic.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
# ****************************************************************************
117117

118118
from copy import copy
119+
import operator
119120

120121
from sage.arith.misc import integer_ceil, integer_floor, xlcm
121122
from sage.arith.srange import xsrange
@@ -151,9 +152,10 @@ def _parse_group_def(parent, operation, identity, inverse, op, *, check_missing=
151152
- ``operation`` -- a string, one of the standard operations
152153
(multiplication or addition) or ``'other'``
153154
- ``identity`` -- the identity element of the group, or ``None``
154-
- ``inverse`` -- a function of one argument returning the inverse
155-
of its argument, or ``None``
156-
- ``op`` -- a function of two arguments returning the group
155+
- ``inverse`` -- if not ``None``, a function taking one argument and
156+
returning its inverse
157+
- ``op`` -- if not ``None``, a function taking two arguments and
158+
computing the group operation on these two arguments
157159
158160
OUTPUT: a tuple ``('other', identity, inverse, op)``
159161
@@ -228,7 +230,6 @@ def _power_func(operation, identity, inverse, op):
228230
sage: _power_func('other', 0, operator.neg, operator.add)
229231
<built-in function mul>
230232
"""
231-
import operator
232233
if op is operator.add:
233234
return operator.mul
234235
if op is operator.mul:
@@ -256,7 +257,6 @@ def _ord_from_op(x, op):
256257
sage: _ord_from_op(mod(2, 5), operator.mul)
257258
4
258259
"""
259-
import operator
260260
if op is operator.add:
261261
return x.additive_order()
262262
if op is operator.mul:
@@ -721,7 +721,6 @@ def discrete_log_rho(a, base, ord=None, operation='*', identity=None, inverse=No
721721
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
722722

723723
operation, identity, inverse, op = _parse_group_def(parent(a), operation, identity, inverse, op)
724-
import operator
725724

726725
# should be reasonable choices
727726
partition_size = 20

0 commit comments

Comments
 (0)