semvec/pypi-packages huggingface dataset:
python-optional 1.1.0
Returns None if a dict key does not exist
License: MIT
Keywords: optional dict key,catch keyerror

# Python Optional

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rogervila_python_optional&metric=alert_status)](https://sonarcloud.io/dashboard?id=rogervila_python_optional)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=rogervila_python_optional&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=rogervila_python_optional)


Returns `None` if a dict key does not exist


## Install

```sh
pip install python_optional
```

## Usage

```py
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
```