Python dict accessible by dot.
Project description
Python dict accessible by dot
Usage:
from dictdot import dictdot
d = dictdot()
d["a"] = 1
assert d["a"] == d.a
d.b = 2
assert d["b"] == d.b
# builtin attributes are not overriden.
d.items = "foo"
assert d.items != d["items"]
assert hasattr(d.items, "__call__")
# d["no_valid_key"] will raise KeyError, but
assert d.no_valid_key is None
# delete by attribute name.
del d.b
assert "b" not in d.keys()
# `copy` method will return a regular dict.
d2 = d.copy()
assert type(d2) != type(d)
assert type(d2) is dict
Project details
Release history Release notifications | RSS feed
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
dictdot-1.0.1-py3-none-any.whl
(13.9 kB
view hashes)