Skip to main content

Dictionary with attribute access to keys

Project description

Attribute Dictionary

Build Status

attd is a Python module that provides a dictionary with attribute access to keys. It is especially convenient when working with deeply nested data from JSON APIs.

Installation

pip install attd

Documentation

>>> from attd import AttributeDict
>>> data = AttributeDict({"a": {"b": {"c": 1}}})
>>> data["a"]["b"]["c"]
1
>>> data.a.b.c
1
>>> from attd import FallbackAttributeDict
>>> data = FallbackAttributeDict({})
>>> data["a"]["b"]["c"]
FallbackAttributeDict()
>>> data.a.b.c
FallbackAttributeDict()

Check the source code for details – it's short and should be fairly self-explanatory.

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

attd-0.1.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

attd-0.1.1-py3-none-any.whl (4.2 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