1 | initial version |
Saving for posterity. The following code does the job:
class Element(GradedLieAlgebra.Element):
def degree(self):
l = [m for m in self]
monomials = [x[0] for x in l]
dictionary = self.parent().name_degree_map
degrees=self.parent()._degrees
values = [dictionary[key] for key in monomials if key in dictionary]
return max(values)