Skip to main content

Dottable Dictionary

Your everyday dictionary, with the special ability to be accessed using dot-notation.

Use dottable dictionaries to turn this:
d["somekey"]["some_inner_key"]["some_internal_key"]
to this:
d.somekey.some_inner_key.some_internal_key.

Background

The basic idea behind this package was to migrate JavaScript's dot-notation access to Python dictionaries. In many (maybe most) cases, dictionaries are used with keys which can serve as identifiers (for more on those take a look here).
By taking advantage of this, dictionary access can be as intuitive as accessing properties within an object (rather than being constrained to using strings).

Importantly - dottable dictionaries are first and foremost dictionaries. Therefore, they implement the same basic functionalities as native dict objects, and are generally designed to interact with them as seamlessly as possible, such that using dottable dictionaries should be compatible with existing code and/or any external module/package.

Functionality

Dictionary functionality

Some basic native dict functionalities which are implemented in dottable dictionaries:

  • copy()
  • update()
  • keys(), values(), items()
  • in operator (__contains__())
  • Iterability (__iter__)
  • TBD: setdefault

Extra functionality

Some extra functionality (extending native dict functionality):

  • Adding & merging: merging mappings to get a unified view of all values (also availble using the + operator)
  • Access by complex string paths - set/get properties using a dot-separated path (e.g., ["a"]["b"]["c"] <-> "a.b.c"). This can be useful for dynamically accessing properties in objects with complex data schemas.
  • Immutable copies - generating an immutable copy of the current state of the mapping. This is also used to allow a pseudo-hash of the mapping (i.e., hash of the current state)

Conversions

Dottable dictionaries can be directly (recursively) converted to native dict objects by using the simple_dict property.

Metadata

Release files for dottable-dict 0.0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dottable-dict 0.0.5.1
File Size Uploaded
dottable_dict-0.0.5.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dottable-dict 0.0.5.1
File Interpreter ABI Platform
dottable_dict-0.0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / dottable_dict-0.0.5.1.tar.gz

Download URL dottable_dict-0.0.5.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
39e47c9909c607f2ada9586855bbf6df9c5f5e931c988d795bfc4d1117d1d017
BLAKE2b-256 checksum
How to use checksums
630102800c1404ba2859cc567de8e088af5e238acf6ceb387dd54f531363be14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / dottable_dict-0.0.5.1-py3-none-any.whl

Download URL dottable_dict-0.0.5.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c40f06dbe0c711797ed77327be78da484586bb9a713b190a66c183ee6150ab53
BLAKE2b-256 checksum
How to use checksums
8dda54afa5a517a26022ea731e9e80992f5ef469e2158523e938b016f1216973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.0.5.1 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page