diff --git a/pymath/calculus/decorators.py b/pymath/calculus/decorators.py index d533968..2773582 100644 --- a/pymath/calculus/decorators.py +++ b/pymath/calculus/decorators.py @@ -3,20 +3,6 @@ from functools import wraps -def is_same_step(new, old): - """Return whether the new step is the same than old step - """ - try: - if new.replace(" ", "") == old.replace(" ", ""): - return True - else: - return False - except AttributeError: - if new == old: - return True - else: - return False - def no_repetition(equals=lambda x,y: x == y): """ Remove yield values which has already been yield diff --git a/pymath/calculus/explicable.py b/pymath/calculus/explicable.py index 0a54f1c..9e46d74 100644 --- a/pymath/calculus/explicable.py +++ b/pymath/calculus/explicable.py @@ -5,7 +5,7 @@ from .renderable import Renderable from .step import Step from decimal import Decimal from .generic import transpose_fill -from .decorators import is_same_step, no_repetition +from .decorators import no_repetition class Explicable(Renderable): @@ -57,7 +57,7 @@ class Explicable(Renderable): """ Generator which yield itself rendered """ yield self.STR_RENDER(self.postfix_tokens) - @no_repetition(is_same_step) + @no_repetition() def history_generator(self): r""" Generator for rendered steps which leed to itself diff --git a/pymath/calculus/step.py b/pymath/calculus/step.py index da97089..bf6aa05 100644 --- a/pymath/calculus/step.py +++ b/pymath/calculus/step.py @@ -69,6 +69,14 @@ class Step(Renderable): exp )) + def __eq__(self, other): + try: + if self.postfix_tokens == other.postfix_tokens: + return True + except AttributeError: + return False + + return False # ----------------------------- # Reglages pour 'vim'