Give a name to polynomDeg2

This commit is contained in:
Lafrite 2015-03-08 19:05:15 +01:00
parent 285b71d2da
commit 68f6cb32d4

View File

@ -16,7 +16,7 @@ class Polynom_deg2(Polynom):
""" """
@classmethod @classmethod
def random(self, coefs_form = ["{c}", "{b}", "{a}"], conditions = [], letter = "x"): def random(self, coefs_form = ["{c}", "{b}", "{a}"], conditions = [], letter = "x", name = "P"):
""" Create a 2nd degree poly from coefs_form ans conditions """ Create a 2nd degree poly from coefs_form ans conditions
:param coefs_form: list of forms (one by coef) (ascending degree sorted) :param coefs_form: list of forms (one by coef) (ascending degree sorted)
@ -33,7 +33,7 @@ class Polynom_deg2(Polynom):
# On "parse" ce string pour créer les coefs # On "parse" ce string pour créer les coefs
coefs = [eval(i) if type(i)==str else i for i in eval(coefs)] coefs = [eval(i) if type(i)==str else i for i in eval(coefs)]
# Création du polynom # Création du polynom
return Polynom_deg2(coefs = coefs, letter = letter) return Polynom_deg2(coefs = coefs, letter = letter, name = name)
def __init__(self, coefs = [0, 0, 1], letter = "x", name = "P"): def __init__(self, coefs = [0, 0, 1], letter = "x", name = "P"):
if len(coefs) < 3 or len(coefs) > 4: if len(coefs) < 3 or len(coefs) > 4: