diff --git a/pymath/calculus/decorators.py b/pymath/calculus/decorators.py index 2773582..4763ae7 100644 --- a/pymath/calculus/decorators.py +++ b/pymath/calculus/decorators.py @@ -3,10 +3,11 @@ from functools import wraps -def no_repetition(equals=lambda x,y: x == y): +def no_repetition(equals=lambda x,y: x == y, old = ""): """ Remove yield values which has already been yield - :param fun: a generator + :param equals: test for equality + :param old: initiate form of data. :returns: same generator with no repetitions >>> norep = no_repetition() @@ -22,7 +23,7 @@ def no_repetition(equals=lambda x,y: x == y): @wraps(fun) def dont_repeat(*args, **kwrds): gen = fun(*args, **kwrds) - old_s = "" + old_s = old while True: try: new_s = next(gen)