solve bug in polynom with Expression.set_render

This commit is contained in:
Lafrite 2014-12-21 18:22:33 +01:00
parent 09ceb07f41
commit a4a58f05a0
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,10 @@ class Expression(object):
def set_render(cls, render): def set_render(cls, render):
cls.STR_RENDER = render cls.STR_RENDER = render
@classmethod
def get_render(cls ):
return cls.STR_RENDER
@classmethod @classmethod
def set_default_render(cls): def set_default_render(cls):
cls.set_render(cls.DEFAULT_RENDER) cls.set_render(cls.DEFAULT_RENDER)

View File

@ -254,9 +254,10 @@ class Polynom(object):
# On converti en Expression # On converti en Expression
coef_exp = Expression(postfix_add) coef_exp = Expression(postfix_add)
old_render = Expression.get_render()
Expression.set_render(lambda _,x:Expression(x)) Expression.set_render(lambda _,x:Expression(x))
coef_steps = list(coef_exp.simplify()) coef_steps = list(coef_exp.simplify())
Expression.set_default_render() Expression.set_render(old_render)
elif type(coef) == Expression: elif type(coef) == Expression: