Returns None if a dict key does not exist
Project description
Python Optional
Returns None
if a dict key does not exist
Install
pip install python_optional
Usage
from python_optional import optional
data = {
'a' : 'b'
}
result = optional(data).get('a') # 'b'
result = optional(data).a # 'b'
result = optional(data).get('z') # None
result = optional(data).z # None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_optional-1.1.0.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file python_optional-1.1.0.tar.gz
.
File metadata
- Download URL: python_optional-1.1.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b93c473452c4efc1fd8e1ac96cadc324b86c9ed02ef162e2b8d3a13dd7cb8b |
|
MD5 | 515799b8808803aad7064e3e5cdc34b0 |
|
BLAKE2b-256 | efa8b03a0a2bad8c5cf141ca0ccf26f905181036049fb00cf56a37499b80501e |
File details
Details for the file python_optional-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: python_optional-1.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef3d7d159f512964698a4aa8e5720427b87f6e5ba676cec593fb6e75f7d92fdc |
|
MD5 | 6ed9b0ed9b637e8f7d8ec340da802233 |
|
BLAKE2b-256 | 648a1fcf3540c018092e45e49f014fa566e9493cf8972f6d035b3d802d7e8bfb |