add __getitem__ and __setitem__ to Expression

This commit is contained in:
Lafrite 2014-12-20 16:52:45 +01:00
parent 1acf73c598
commit 9dbe971cd1

View File

@ -147,6 +147,15 @@ class Expression(object):
return 0 return 0
return 1 return 1
# -----------
# Expression act as container from self.postfix_tokens
def __getitem__(self, index):
return self.postfix_tokens[index]
def __setitem__(self, index, value):
self.postfix_tokens[index] = value
# ----------- # -----------
# Some math manipulations # Some math manipulations