Skip to main content

A None alternative for Python that reduces the need for None checks.

Project description

nothingpy

Nothing is a replacement for None that eliminates the need for many if statements. I am tried of writing code like this:

if some_list is not None:
    for item in some_list:
        do_something(item)

If you use Nothing instead of None, you can write code like this:

some_list = Nothing
for item in some_list:
    do_something(item)

Nothing is a global variable of the class NothingClass. Nothing has a len of 0, is False, returns an empty iterable, converts to an empty string, and responds to values(), keys() and items() like an empty dictionary. Nothing equals other NothingClass instances, None and False.

Installation

pip install nothingpy

Usage

from nothingpy import Nothing

some_variable = Nothing

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

nothingpy-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nothingpy-0.1.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file nothingpy-0.1.2.tar.gz.

File metadata

  • Download URL: nothingpy-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for nothingpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8a45e005bf2d5c4d95ddc37ddd08562d308076d56e583497d1f08849a7e05cb1
MD5 94f69385158f034e0b3d8fb96e410aef
BLAKE2b-256 ff14486a4c6d512281d68a01471232175eca6774b19e49610f789c6c2ee07184

See more details on using hashes here.

File details

Details for the file nothingpy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nothingpy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for nothingpy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec8a91d382594173e8db59b6991a5239633a2bee43dfaa056d367de612abbe7b
MD5 a136aaed0f19c7efba3e5b7415aafd6d
BLAKE2b-256 dd546a86cdd506b8e4214199689f4b21c08f63445583bc1b328c3283558b0c43

See more details on using hashes here.

Supported by

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