nulltype
Null values and sentinels like (but not) None, False & True
What it is and what it does
nulltype lets you create custom null-like sentinel values—instances of NullType or NonNullType—that behave like empty containers (falsy, iterable, indexable) but carry semantic meaning distinct from None. Instead of overloading None to mean "not present," "undefined," "prohibited," or "end of data," you can define separate sentinels like Empty, Nothing, or Passthrough, each with a clear purpose.
The main use case is simplifying nested data access patterns common in REST API responses, XML trees, and other deeply nested structures. Instead of writing guard clauses at each level, you can chain .get() calls with a Nothing sentinel as the fallback, and the sentinel will safely absorb further operations (attribute access, iteration, indexing, calls) without raising exceptions. The package is pure Python with no dependencies, tested against Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7, and distributed under Apache License 2.0.
Use it for:
- Parsing REST API responses where nested keys may be absent, replacing repeated if-checks with chainable .get() calls using Nothing as a default.
- Traversing XML or JSON parse trees where intermediate nodes might not exist, using a single sentinel to represent all missing branches.
- Creating domain-specific sentinel values (e.g., Prohibited, Undefined, Passthrough) to distinguish different kinds of emptiness in business logic.
- Replacing ad-hoc sentinel classes or magic values with named, printable NullType instances for clarity.
- Implementing the null object pattern in Python without overloading None or False, making code intent explicit.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Defines custom null and sentinel values that behave like empty containers or designated markers, distinct from Python's built-in None, False, and True.
Yes, if you are working with nested data structures (APIs, XML, JSON) and want cleaner, more readable code for handling missing values. No, if you require active maintenance—the package is abandoned as of 2018-06-03. For new projects, verify compatibility with your Python version and consider whether a modern alternative better fits your codebase.
Install
nulltype on PyPI
pip
pip install nulltypeuv
uv add nulltypepoetry
poetry add nulltypeInstalling nulltype
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance status is abandoned (last release 2018-06-03, 2994 days ago), so no active bug fixes or Python version updates should be expected.
License in practice
Apache License 2.0 (permissive): you may use, modify, and distribute this package freely in commercial and private projects, provided you include a copy of the license and state any changes made.
Quickstart
pip install nulltype
from nulltype import Empty, Nothing
results = {"threads": None}
for thread in results.get("threads", Nothing):
print(thread)
Verify before relying
- Whether the package remains compatible with Python versions released after 2018 despite no recent maintenance.
- Real-world adoption rate and whether it is still actively used in production codebases.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,994 days since the last release |
| First released | |
| Downloads | 3,233,025/month — #2,691 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nulltype-2.3.1-py2.py3-none-any.whl
Keywords: null, none, nothing, Empty, False, True, singleton, sentinel
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
empty-filesCreates minimal valid empty files of various…
permissive · top 15,000 on PyPI
func_argsProvides sentinel values (REQ and OPT) and…
permissive · top 5,000 on PyPI
sentinelCreates singleton sentinel objects that…
permissive · top 15,000 on PyPI
niltypeProvides a `Nil` singleton object to represent…
permissive · top 15,000 on PyPI
sentinelsProvides singleton sentinel objects with…
permissive · top 5,000 on PyPI
pytest-reraiseCaptures exceptions raised in threads during…
permissive · top 15,000 on PyPI
pytest-raceProvides a pytest fixture that runs test…
permissive · top 15,000 on PyPI
Redis-Sentinel-UrlParses redis:// and redis+sentinel:// URLs and…
permissive · top 15,000 on PyPI
coredisAn async Redis client with full type hints,…
permissive · top 5,000 on PyPI
iteratorsWraps Python iterators to add timeout behavior,…
permissive · top 15,000 on PyPI