A simple Package to replace the awkward built-in ternary operator with a function call.
Project description
beautiful-ternary
A simple Python Package to replace the awkward built-in ternary operator with a function call. Simple.
Usage
pip install beautiful-ternary
from ternary import tif, tlif
# Use this for non-lazy ternary
tif(condition, return-if-true, return-if-false)
# Use this for lazy ternary
tlif(condition, lambda: return-if-true, lambda: return-if-false)
Dependencies
build, twine, pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file beautiful-ternary-1.1.0.tar.gz
.
File metadata
- Download URL: beautiful-ternary-1.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24a63dfb491ebbb2fcccdc0ba699213a5068f4a8ac52b5d03d19d5626e633e3c |
|
MD5 | ecf552e74320626f7ab1aa86335d97d4 |
|
BLAKE2b-256 | 7481ba8945662c9893a2986e463776ed07eadbb1adc4cc50323e03a5b9bb77dd |
File details
Details for the file beautiful_ternary-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: beautiful_ternary-1.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b1b4b515e05293b35c17e77adf324e2f84227248aad8d59b2570b5ff4aa658c |
|
MD5 | e0deaf49d4bf2e30a73dc267c3a1444f |
|
BLAKE2b-256 | cbb274bf39c1a8b7d4648be91c32b223c1ff34164afcd0bd626d240853a7c2c1 |