Simply a global object that act as undefined.
Project description
Undefined
Ever needed a global object that act as None but not quite ?
Like for example key-word argument for function, where None make sens, so you need a default value.
One solution is to create as singleton object:
mysingleton = object()
Though it becomes difficult to track the singleton across libraries, and teach users where to import this from.
It’s also relatively annoying use this singleton across library.
Introducing undefined:
>>> import undefined >>> from undefined import Undefined >>> undefined is Undefined True
behavior
It work (for now) mostly like a singleton object, meaning it’s truth-y
>>> if undefined: print(True) True
Casing ?
Because it is a module you can use it lowercase:
import undefined
Because it looks more like a keyword (None, True, False), you can use it upper case:
import undefined as Undefined
or
from undefined import Undefined
I tend to be torn between lowercase, for simplicity, and Uppercase.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file undefined-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: undefined-0.0.3-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ba806f427cc2aae05f42b7ad333bdfb632da50d092876735263c771544864a4 |
|
MD5 | 8f398403fc6f7f01ef892a2e47bf3526 |
|
BLAKE2b-256 | 8eb3eb71b717066e10aae04f83f544d91144aea0463cf8497146f484612396b1 |