Skip to main content

pydotted

Project description

PyDotted

coverage

A very simple low code footprint dictionary with dot notation attribute (x.y) access, including nested dicts.

Installation:

From git:

pip install git+https://github.com/aredden/pydotted.git

From pypi:

pip install pydotted

Examples & Usage:

from pydotted import pydot

d = pydot({"a": 1})

print(d.a)
# prints 1

d.b = d.a + 4

print(d.b)
# prints 5

d.c = {"b": object(), "a": 123}

print(d)
# prints {'a': 1, 'b': 5, 'c': {'b': <object object at 0x...>, 'a': 123}}

print(d.c.a)
# prints 123

d.a = {"e": {"f": {"h": {"i": "j"}}}}

print(d.a.e.f.h.i)
# prints "j"


# Still supports normal dictionary property access
d["j"] = 20

print(d.j)
# prints 20

d.a.e.f.h.i = [{"a": {"b": "c"}}]

# Supports nested lists within dictionaries within lists, (etc...) :)
print(d.a.e.f.h.i[0].a.b)
# prints "c"

# Supports deeply nested lists
d.b = [[[[[{"a":{"b":1}}]]]]]
print(d.b[0][0][0][0][0].a.b)
# prints 1

Updates as of 1/8/22

New Method: todict()

Returns a non-pydot dictionary containing the converted object and nested objects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydotted-0.0.8-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pydotted-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: pydotted-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for pydotted-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b85ff6e048d6781b546b0e5b81b8d0f4400f4b4920bfa0fef5e8ab1fbd982867
MD5 b129b79f0a73712949702e78db54ca55
BLAKE2b-256 79bb79a49e6692261b897ca9613054d77bc105de687622bbfa56f0799cd5433c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page