Ajout d'une méthode str pour les RpnExpr
This commit is contained in:
parent
8957f507db
commit
cc0d798302
1 changed files with 3 additions and 0 deletions
|
|
@ -60,6 +60,9 @@ class RpnExpr(list):
|
|||
raise TypeError('RpnSymbol expected but got %s' % type(val))
|
||||
super().__setitem(idx, val)
|
||||
|
||||
def __str__(self):
|
||||
return ' '.join([str(sym) for sym in self])
|
||||
|
||||
@classmethod
|
||||
def random(cls, sz):
|
||||
return cls([RpnSymbol.random() for _ in range(sz)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue