Simple Python library determining whether strings indicate truey or falsy values
Project description
py2be
Simple Python library determining whether strings indicate truey or falsy values.
Introduction
to-be is a library providing facilities for determine whether the truthyness of strings. It implemented in several languages: py2be is the Python implementation.
Table of Contents
Terminology
The term "truthy" is an unhelpfully overloaded term in the programming world, insofar as it is used to refer to the notion of "truthyness" - whether something can be deemed to be interpretable as truth - and also the true side of that interpretation. In this library, the former interpretation is used, leaving us with the following terms:
- "truthy" - whether something can be can be deemed to be interpretable as having truth;
- "falsey" - whether an object can be deemed to be interpretable as being false;
- "truey" - whether an object can be deemed to be interpretable as being true;
For example, consider the following Python program:
from py2be import (
string_is_falsey,
string_is_truey,
string_is_truthy,
)
s1 = "no"
s2 = "True"
s3 = "orange"
# "no" is validly truthy, and is falsey
assert string_is_falsey(s1)
assert !string_is_truey(s1)
assert string_is_truthy(s1)
# "True" is validly truthy, and is truey
assert !string_is_falsey(s2)
assert string_is_truey(s2)
assert string_is_truthy(s2)
# "orange" is not validly truthy, and is neither falsey nor truey
assert !string_is_falsey(s3)
assert !string_is_truey(s3)
assert !string_is_truthy(s3)
Project Information
Where to get help
Contribution guidelines
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/py2be.
Dependencies
py2be has no (non-development) dependencies.
Dev Dependencies
py2be has no (additional) development dependencies.
Related projects
- to-be (C);
- to_be.Ruby;
- to-be.Rust;
License
py2be is released under the 3-clause BSD license. See LICENSE for details.
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
File details
Details for the file py2be-0.0.3.tar.gz.
File metadata
- Download URL: py2be-0.0.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3661d59da82dc9e6e17bfe67a7e331c6f8218675aec0830a2a57add26715971e
|
|
| MD5 |
9f705fb9ce253e854b266f6212c79205
|
|
| BLAKE2b-256 |
fe359bf64f6585257f8a1dd9f3894703280d120737a5b42c25b15afe1ee083c4
|