Synopsis
tt is a Python library and command-line tool for working with Boolean expressions. Please check out the project site for more information.
Installation
tt is tested on CPython 2.7, 3.3, 3.4, 3.5, and 3.6. You can get the latest release from PyPI with:
pip install ttable
Basic Usage
tt aims to provide a Pythonic interface for working with Boolean expressions. Here are some simple examples from the REPL:
>>> from tt import BooleanExpression, TruthTable
>>> b = BooleanExpression('A xor (B and 1)')
>>> b.tokens
['A', 'xor', '(', 'B', 'and', '1', ')']
>>> b.symbols
['A', 'B']
>>> print(b.tree)
xor
`----A
`----and
`----B
`----1
>>> b.evaluate(A=True, B=False)
True
>>> t = TruthTable(b)
>>> print(t)
+---+---+---+
| A | B | |
+---+---+---+
| 0 | 0 | 0 |
+---+---+---+
| 0 | 1 | 1 |
+---+---+---+
| 1 | 0 | 1 |
+---+---+---+
| 1 | 1 | 0 |
+---+---+---+
>>> t = TruthTable(from_values='01xx')
>>> t.ordering
['A', 'B']
>>> for inputs, result in t:
... inputs, result
...
(<BooleanValues [A=0, B=0]>, False)
(<BooleanValues [A=0, B=1]>, True)
(<BooleanValues [A=1, B=0]>, 'x')
(<BooleanValues [A=1, B=1]>, 'x')
>>> t.equivalent_to(b)
True
License
tt uses the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ttable-0.6.0.tar.gz.
File metadata
- Download URL: ttable-0.6.0.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61365efee15a7fc5ad97f3959ea9a94dc0ad7e393d9fff06b1d222062fa024ee
|
|
| MD5 |
bd040b243e20ce2e8385cfa6b894e964
|
|
| BLAKE2b-256 |
7ad117406adf297fe5f3384bf167b0a0b895be5ed5fcb008dcc9fafba17f4b79
|
File details
Details for the file ttable-0.6.0-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: ttable-0.6.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 63.2 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5277fc46a16b54d34ba7905baace73639ef9611df51b2e73b9bae3e11c81507d
|
|
| MD5 |
b06224fe1de399acc60bc6034e2681da
|
|
| BLAKE2b-256 |
052446a4154a31b9b234bdecd918d84011d4a9cf466b4fbf2a2d534e4787bee1
|
File details
Details for the file ttable-0.6.0-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: ttable-0.6.0-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 63.2 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ae7d0368b37807b1930f55d9791ed1d5193464542aa0e6b3dc3ef462944b89b
|
|
| MD5 |
9a70f3f4ca515f690a5562b8fbdbd892
|
|
| BLAKE2b-256 |
b1635e7232f007ab0c23a44ffb730f36f4859df22da12a9ae17882ea1bc47c58
|
File details
Details for the file ttable-0.6.0-cp34-cp34m-win_amd64.whl.
File metadata
- Download URL: ttable-0.6.0-cp34-cp34m-win_amd64.whl
- Upload date:
- Size: 68.3 kB
- Tags: CPython 3.4m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d75d4157c5b25d81ae577430e9cea73fa5018db12d1666b856e3543ea3246bda
|
|
| MD5 |
b1952b322dee911d887c2a81d20aded1
|
|
| BLAKE2b-256 |
9ec4de335fceb50f855fafec31a5c199b82d768a80338cea8a34ae501c3b61ff
|
File details
Details for the file ttable-0.6.0-cp33-cp33m-win_amd64.whl.
File metadata
- Download URL: ttable-0.6.0-cp33-cp33m-win_amd64.whl
- Upload date:
- Size: 68.3 kB
- Tags: CPython 3.3m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4463fdc41c00bd4c6c9c6195c9fff8d94db4ceb81acd5cd57332bf00f6b5c59b
|
|
| MD5 |
476f8437fd045832a1b4c42d2ccfa7aa
|
|
| BLAKE2b-256 |
77baea182d57760a44d93362aca3e2e2dc3f6b5ecf59b7a57ae4e46ba4248996
|
File details
Details for the file ttable-0.6.0-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: ttable-0.6.0-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 68.7 kB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8819cab655921f3507e0bcc775832614cf29c4f8642d3eac76f89a0af279219e
|
|
| MD5 |
4f23785f84ee135ffe9ac5d4caa5ce2f
|
|
| BLAKE2b-256 |
4e25a1e6e8145ced252e944324e59a1a162c328e8c6da4765c11a2db31a34b87
|
File details
Details for the file ttable-0.6.0-cp27-cp27m-macosx_10_11_x86_64.whl.
File metadata
- Download URL: ttable-0.6.0-cp27-cp27m-macosx_10_11_x86_64.whl
- Upload date:
- Size: 81.9 kB
- Tags: CPython 2.7m, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69a35d11de1bf054908924fef0968cd2fded98ed10dafe624acbda41c4f5828d
|
|
| MD5 |
4ddf8d71a7977cf3ef002eaa151c4c93
|
|
| BLAKE2b-256 |
8bf6ef254c8bff1212ca50e74d15cdfca0e2cfc83127aa5a5a9368ee904d660f
|