Skip to content

Commit fe6d17c

Browse files
changed ValueError to NotImplementedError in __eq__ method and removed private method _remove_duplicates_of
1 parent b19c2e7 commit fe6d17c

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ def __init__(self, systems):
301301
(x^2 : y^2)
302302
"""
303303

304-
self._dynamical_systems = _remove_duplicates_of_(systems)
304+
self._dynamical_systems = []
305+
for ds in systems:
306+
if ds not in self._dynamical_systems:
307+
self._dynamical_systems.append(ds)
305308
Parent.__init__(self, category=Semigroups().FinitelyGeneratedAsMagma())
306309

307310
def __call__(self, input):
@@ -544,12 +547,12 @@ def __eq__(self, other):
544547
sage: f == g
545548
Traceback (most recent call last):
546549
...
547-
ValueError: cannot compare dynamical semigroups with at least one generator of degree 1
550+
NotImplementedError: cannot compare dynamical semigroups with at least one generator of degree 1
548551
"""
549552
if isinstance(other, DynamicalSemigroup):
550553
if any(ds.degree() == 1 for ds in self.defining_systems()) or \
551554
any(ds.degree() == 1 for ds in other.defining_systems()):
552-
raise ValueError("cannot compare dynamical semigroups with at least one generator of degree 1")
555+
raise NotImplementedError("cannot compare dynamical semigroups with at least one generator of degree 1")
553556
return all(ds in other.defining_systems() for ds in self.defining_systems()) and \
554557
all(ds in self.defining_systems() for ds in other.defining_systems())
555558
return False
@@ -677,30 +680,6 @@ class DynamicalSemigroup_affine_field(DynamicalSemigroup_affine):
677680
class DynamicalSemigroup_affine_finite_field(DynamicalSemigroup_affine_field):
678681
pass
679682

680-
def _remove_duplicates_of_(list):
681-
r"""
682-
Removes duplicate elements from a list.
683-
684-
INPUT:
685-
686-
- ``list`` -- any list
687-
688-
OUTPUT: the original list without duplicate elements
689-
690-
EXAMPLES::
691-
692-
sage: numbers = [1, 1, 2, 3, 3, 2, 1, 5, 4, 3]
693-
sage: sage.dynamics.arithmetic_dynamics.dynamical_semigroup._remove_duplicates_of_(numbers)
694-
[1, 2, 3, 5, 4]
695-
"""
696-
seen = []
697-
698-
for item in list:
699-
if item not in seen:
700-
seen.append(item)
701-
702-
return seen
703-
704683
def _standardize_domains_of_(systems):
705684
r"""
706685
Coerces dynamical systems to the same domain and have the same generators.

0 commit comments

Comments
 (0)