Reputation: 25
I am using Truths class to generate a truth table : https://github.com/tr3buchet/truths
However I could not enumerate all rows or extract rows with correct evaluation of expression? Is there a way to do that ?
I received this error : AttributeError: 'Truths' object has no attribute 'rows' thanks in advance
I can only get the table printed but I could not change it ?
how can I extracted specific rows from table ?
Upvotes: 0
Views: 59
Reputation: 2146
A Truths
object stores almost exclusively the information that is provided during initialization. That is: the base
items, the phrases
(optional) and the ints
(also optional).
The only other things are:
base_conditions
, which stores the part of the table with the base
columnsThe latter one can be accessed like this:
t = Truths(['a', 'b', 'c'], ['(a and b)', 'a and b or c']) # example
t.base_conditions # == [(False, False, False), (False, False, True), ... (True, True, True)]
The rest of the table is generated on the fly when the table is printed.
If you have not done it already, have a look at the code in the git repository.
Upvotes: 0