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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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