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 tired of writing code like this:

if some_list:
    for item in some_list:
        do_something(item)

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nothingpy-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 505effb4c841dbefd6740d0c6d186e7fc5f75fdaae5816cc5a420c76a4eb1f34
MD5 b7eeada79aef886f95d9256467176dd1
BLAKE2b-256 19cc49ed6fd9c42391c74a1e88ee59d489739164ed6becf4f9867b8e7c2137dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nothingpy-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2bb8f9a738538b8af1e0ef1aa81768e6475aa798f83d625e3989836f3b8b0ff3
MD5 9c9eb7f08a3b7f4c3dcdd0f852995491
BLAKE2b-256 722363e0fd1a1b004230862f4ff0ba63801f25fb0db6f904ceabb927ec3695e9

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