Skip to main content

Fix for boolean variables in Python

Project description

booleanfix

The most useless pip package so far
PyPI version

The problem

If you come from another programming language, you may have noticed that Python's boolean variables are a bit different. This module aims to fix that, by giving you boolean variables like you're used to.

The solution

This very simple project gives you boolean variables like you're used to. It's as simple as that.
Note : Since v1.1.0, booleanfix also allows you to use null and undefined as None.

Behind the scenes

true = True
false = False
null = None
undefined = None

Usage

  1. Install the package in your repo
pip install booleanfix==1.1.0

If you use a requirements file, add this line to it :

booleanfix==1.1.0
  1. Use it in your code

    a. The classic way

    import booleanfix as bf
    
    print(isinstance(bf.true, bool))
    print(bf.false == False)
    

    b. The easy way

    from booleanfix import true, false
    
    print(isinstance(true, bool))
    print(false == False)
    

Example

from booleanfix import true, false, null, undefined

array = [1, 2, 3, 4, 5]
for i in range(len((array))):
	if array[i] % 2 == 0:
		array[i] = true
	else:
		array[i] = false

print(array)

for i in array:
	print(type(i), isinstance(i, bool), i)

if null == undefined:
	print("null == undefined")

if array[5] == null:
	print("array[5] == null")

Contributing

Feel free to open an issue or a pull request if you want to contribute to this project

How to build ?

py -m pip install --upgrade pip build twine setuptools wheel
py -m build
py -m twine check dist/*
# Optional : publish to test.pypi.org
py -m twine upload --repository testpypi dist/*
# Or to pypi.org
py -m twine upload dist/*

How to test ?

py -m pip install --upgrade pytest
py -m pytest

License

This project is licensed under the MIT License - see the LICENSE file for details

Authors

  • EDM115 - Initial work - EDM115

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

booleanfix-1.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

booleanfix-1.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file booleanfix-1.1.0.tar.gz.

File metadata

  • Download URL: booleanfix-1.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for booleanfix-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6e7e92295f68f79ddc9f8ca7946a4232d7e61851fed19afd218b02595f011c24
MD5 42559d538f99cdd9c3b6d1da58a58632
BLAKE2b-256 caaca6a9e165c78f4b92bbfa57f638aeff8692dbef32793f1ded36f70c939272

See more details on using hashes here.

File details

Details for the file booleanfix-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: booleanfix-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for booleanfix-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efa18bac6f5bc9137a821dd9a8a770b4f3037e8eaf11c036e2ac655b193d9874
MD5 a245b1596fa136c6a704d2ef437ba953
BLAKE2b-256 45c45ba96cc73ea5a8979a12f1181c875fc4703deb431391320d7e7c442385e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page