Skip to main content

Dotty dict-like object allow to access deeply nested keys using dot notation.

Project description

dotty_dict

https://img.shields.io/pypi/v/dotty_dict.svg https://img.shields.io/travis/pawelzny/dotty_dict.svg Documentation Status Updates

Dotty dictionary with support_for[‘dot.notation.keys’].

Dotty dict-like object allow to access deeply nested keys using dot notation. Create Dotty from dict or other dict-like object to use magic of Dotty.

Ultimate goal is to match all Python dictionary method to work with deeply nested Dotty keys.

Features

  • Access and assign deeply nested dictionary key using dot notation

  • Return None if key doesn’t exist instead of KeyError exception

  • Get deeply nested value or default value with .get() method

TODO

  • Escape dot char for dictionary keys with dot: dotty_dict[‘key.key’]

  • Delete deeply nested keys: del dotty_dict[‘key.key’]

  • Check if key exists in deeply nested dictionary: key.key.key in dotty_dict

  • Check if key does not exist in deeply nested dictionary: deeply.nested not in dotty_dict

  • Pop nested key: pop( key.key.key[, default] )

  • Set default bug fix

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.9 (2017-05-06)

Changed

  • __getitem__ will call __missing__ method if key does not exist

Added

  • __missing__ method which returns None

  • full documentation of dotty_dict usage

0.1.8 (2017-05-03)

Changed

  • Travis YAML configuration compatible with TOX

0.1.0 (2017-05-03)

Added

  • First release on PyPI.

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

dotty_dict-0.1.9.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

dotty_dict-0.1.9-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 2 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