Skip to main content

Returns None if a dict key does not exist

Project description

Python Optional

Quality Gate Status Maintainability Rating

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


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)

Uploaded Source

Built Distribution

python_optional-1.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

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

Hashes for python_optional-1.1.0.tar.gz
Algorithm Hash digest
SHA256 97b93c473452c4efc1fd8e1ac96cadc324b86c9ed02ef162e2b8d3a13dd7cb8b
MD5 515799b8808803aad7064e3e5cdc34b0
BLAKE2b-256 efa8b03a0a2bad8c5cf141ca0ccf26f905181036049fb00cf56a37499b80501e

See more details on using hashes here.

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

Hashes for python_optional-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef3d7d159f512964698a4aa8e5720427b87f6e5ba676cec593fb6e75f7d92fdc
MD5 6ed9b0ed9b637e8f7d8ec340da802233
BLAKE2b-256 648a1fcf3540c018092e45e49f014fa566e9493cf8972f6d035b3d802d7e8bfb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page