Browse Source

Ajout d'une méthode str pour les RpnExpr

Yann Weber 6 years ago
parent
commit
cc0d798302
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      gte/rpnlib.py

+ 3
- 0
gte/rpnlib.py View File

@@ -60,6 +60,9 @@ class RpnExpr(list):
60 60
             raise TypeError('RpnSymbol expected but got %s' % type(val))
61 61
         super().__setitem(idx, val)
62 62
 
63
+    def __str__(self):
64
+        return ' '.join([str(sym) for sym in self])
65
+
63 66
     @classmethod
64 67
     def random(cls, sz):
65 68
         return cls([RpnSymbol.random() for _ in range(sz)])

Loading…
Cancel
Save