Feat: raw methods for tokens

This commit is contained in:
Bertrand Benjamin 2019-10-16 22:45:41 +02:00
parent c211ed1591
commit 2317296534
2 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,10 @@ class Polynomial(Token):
def random(cls):
raise NotImplementedError
@property
def raw(self):
raise NotImplementedError("Polynomial does not exists in python")
def __setitem__(self, key, item):
""" Use Polynomial like if they were a dictionnary to set coefficients """
raise NotImplementedError("Can't set coefficient of a polynomial")

View File

@ -84,6 +84,11 @@ class Token(object):
def __tex__(self):
return self._mo.__tex__
@property
def raw(self):
""" Get python's raw forme of the token """
return self._mo.value
def _operate(self, other, operation):
""" Make a operation between 2 Tokens """
from ..expression import Expression