A dict implementation with support for easy and clean access of its values through attributes
Project description
attridict
A Python package implementing atrribute dictionary.
This provides an easier and cleaner way to access dict values using their keys as attributes. It is typically a dict child, maintaining all the dict functionalities, but including some extra features.
Installation
To install the package from PyPI, use:
pip install attridict
Usage
>>> import attridict
>>> att = attridict()
>>> att
{}
>>> att.foo = "bar"
>>> att.foo
'bar'
>>> att
{'foo': 'bar'}
>>> import attridict
>>> data = {'red': 'hot', 'blue': 'cold'}
>>> colors = attridict(data)
>>> colors
{'red': 'hot', 'blue': 'cold'}
>>> colors.blue
'cold'
>>> colors.blue = "sky"
>>> colors.red = "rose"
>>> colors.blue
'sky'
>>> colors.red
'rose'
>>> colors
{'red': 'rose', 'blue': 'sky'}
>>> colors.green = "grass"
>>> colors
{'red': 'rose', 'blue': 'sky', 'green': 'grass'}
License
The project is MIT licensed
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
attridict-0.0.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for attridict-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 519cddfa70d553f5cf26dded50f4def749ececc1d73ad62f7ced3c36ee452610 |
|
MD5 | 2a20809f12500538729c49b1426e4ecc |
|
BLAKE2b-256 | 378be976c6f8fe275e51da1bfba8d426da175c996b3525b914df8cfc40403d1f |