Various objects that allow for sentinel-like singletons for various purposes, including:
- Ones pre-defined in this library:
- Default
- Null
- Also, Easily create your own custom singletons/sentinels types.
📄 Detailed Documentation | 🐍 PyPi
# via pip
pip install xsentinels
# via poetry
poetry add xsentinels
from xsentinels import Default
import os
def my_func(my_param = Default):
if my_param is Default:
# Resolve default value for parameter, otherwise None.
my_param = os.environ.get('MY_PARAM', None)
...
This library is licensed under the MIT-0 License. See the LICENSE file.