The repository or configuration that created this release differ from a previous release. View details.
Overview
The sentinels module is a small utility providing the Sentinel class, along with useful instances.
What are Sentinels?
Sentinels are objects with special meanings. They can be thought of as singletons, but they service the need of having 'special' values in your code, that have special meanings (see example below).
Why Do I Need Sentinels?
Let's take NOTHING for example. This sentinel is automatically provided with the sentinels import:
>>> from sentinels import NOTHING
Let's say you're writing a wrapper around a Python dictionary, which supports a special kind of method, get_default_or_raise. This method behaves like get, but when it does not receive a default and the key does not exist, it raises a KeyError. How would you implement such a thing? The naive method is this:
>>> class MyDict(dict):
... def get_default_or_raise(self, key, default=None):
... if key not in self and default is None:
... raise KeyError(key)
... return self.get(key, default)
Or even this:
>>> class MyDict(dict):
... def get_default_or_raise(self, key, default=None):
... returned = self.get(key, default)
... if returned is None:
... raise KeyError(key)
... return returned
But the problem with the above two pieces of code is the same -- when writing a general utility class, we don't know how it will be used later on. More importantly, None might be a perfectly valid dictionary value!
This is where NOTHING comes in handy:
>>> class MyDict(dict):
... def get_default_or_raise(self, key, default=NOTHING):
... returned = self.get(key, default)
... if returned is NOTHING:
... raise KeyError(key)
... return returned
And Tada!
Semantics
Sentinels are always equal to themselves:
>>> NOTHING == NOTHING
True
But never to another object:
>>> from sentinels import Sentinel
>>> NOTHING == 2
False
>>> NOTHING == "NOTHING"
False
Copying sentinels returns the same object:
>>> import copy
>>> copy.deepcopy(NOTHING) is NOTHING
True
And of course also pickling/unpickling:
>>> import pickle
>>> NOTHING is pickle.loads(pickle.dumps(NOTHING))
True
Metadata
Release files for sentinels 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sentinels-1.1.1.tar.gz | 4.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentinels-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / sentinels-1.1.1.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | sentinels-1.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c2f64f754187c19e0a1a029b148b74cf58dd12ec27b4e19c0e5d6e22b5a9a86
|
|
BLAKE2b-256 checksum How to use checksums |
6f9b07195878aa25fe6ed209ec74bc55ae3e3d263b60a489c6e73fdca3c8fe05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2025.
Transparency logRelease files / sentinels-1.1.1-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | sentinels-1.1.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
835d3b28f3b47f5284afa4bf2db6e00f2dc5f80f9923d4b7e7aeeeccf6146a11
|
|
BLAKE2b-256 checksum How to use checksums |
4965dea992c6a97074f6d8ff9eab34741298cac2ce23e2b6c74fb7d08afdf85c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2025.
Transparency logSecurity for sentinels 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Change of provenance
The configuration that created this release differs from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Configuration
- Removed 1.1.0 pypi-publish.yml
- Added 1.1.1 ci.yml
Attestation for sentinels-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.