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.1.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.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nothingpy-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d616589b0321f02372282dca3539166b05fb2b3cd8649b013a61159d7391b65a
MD5 ff64e496a0cf4b40ef650397ab75c64b
BLAKE2b-256 46d85837821b516fd22d7eb0a5772bd2e52ca83359b965c4c226ecfa0d71f3c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nothingpy-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2a4dfbacae8245755d31f5fe32e9ce1bc78c1a862f273f330a8b8cd005957b2
MD5 3d511fd537210922bd1cfb86b11beeb9
BLAKE2b-256 19294c64c54dcc3ac415a538ffa946078ee9df486ba2a3d32e09e25c27088f9c

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