Conversation
__call__methods are added to Symbol, NOT, AND, OR. In short: __call__methods are recursively called on NOT, AND, OR classes, following the logic tree via self.args. When a Symbol instance is found, the corrsponding value (e.g. True/False) is looked up in the kwargs argument and returned to the caller.
pombredanne
left a comment
There was a problem hiding this comment.
Thanks for this! the tests seem to fail on Python3 with NameError: name 'reduce' is not defined... do you mind having a look at these?
|
i split the import and made |
|
Any chance of having this PR merged into master? |
|
@gemerden sure! let me review and merge. Thanks for updating and ensuring the tests pass. |
|
Looking all good to me. I will merge but I need to decide on a merging strategy with regards to the changes by @all3fox first! Thank you for your patience! |
|
Please do keep support for Python 2, I need that. |
|
@Kronuz So do I for sure. So we will keep this alright: The only thing is that these will be two different branches in a near future and will have a few but minor differences (mostly because the transpilation to JS works only on Python3). And I will keep backporting to the Python2 branch as needed for the foreseeable future. |
|
For now i have used boolean.py in a slightly different manner, so i won't be using this directly for now. Therefore do as you like. |
|
Any progress on this PR, it seems such a logical thing to add. |
|
@pombredanne any progress on this, python3 only would be fine for me. |
|
@gemerden sorry for dropping the ball here! do you mind rebasing on the latest develop branch? |
|
@gemerden I would like to get this in the next release soon enough ... Tell me if you can rebase, otherwise I will try to handle it |
|
Good news, also i have never used rebase (and i have no idea what has been changed on master or develop, haven’t looked at the repo since i made the PR), so if you could do it that would be great. I will help as needed ofcourse. |
adds ability to evaluate boolean expressions, as in:
algebra = BooleanAlgebra()
exp = algebra.parse("!(a|b&(a|!c))")
a, b, c = True, False, True
assert exp(a=a, b=b, c=c) == not(a or b and (a or not c))