bastikr / boolean.py

Implements boolean algebra in one module.
BSD 2-Clause "Simplified" License
76 stars 34 forks source link

Fix dual for _TRUE and _FALSE #100

Closed pauleve closed 3 years ago

pauleve commented 3 years ago

The dual member of operators is assumed to be a class. However, for TRUE and FALSE, it is an object.

This leads to errors with simplify() or literalize() within the demorgan() method when applied on TRUE or FALSE objects (e.g., #85)

There are two ways of fixing this: either assign the dual member of TRUE and FALSE to the corresponding class, or add a __call__ method to these objects returning themselves.

This PR adopts the latter approach to respect as much as possible the singleton design pattern.

pombredanne commented 3 years ago

@pauleve Thank you ++ for this! let me review and merge shortly