attridict-0.0.6
توضیحات
A dict implementation with support for easy and clean access of its values through attributes
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | attridict-0.0.6 |
| نام | attridict |
| نسخه کتابخانه | 0.0.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Alvin Shaita |
| ایمیل نویسنده | alvinshaita@gmail.com |
| آدرس صفحه اصلی | https://github.com/alvinshaita/attridict |
| آدرس اینترنتی | https://pypi.org/project/attridict/ |
| مجوز | MIT License |
# 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
Creating an attridict object
```python
>>> import attridict
>>> att = attridict()
>>> att
{}
>>> att.foo = "bar"
>>> att.foo
'bar'
>>> att
{'foo': 'bar'}
```
<br/>
A dict can be converted into an attridict object by passing it as an argument
```python
>>> import attridict
>>> data = {'red': 'hot', 'blue': 'cold'}
>>> colors = attridict(data)
>>> colors
{'red': 'hot', 'blue': 'cold'}
>>> colors.red
'hot'
```
<br/>
Modifying attridict object
```python
>>> 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'}
```
<br/>
Typical `dict` operations work on attridict objects
```python
>>> import attridict
>>> data = {'red': 'rose', 'blue': 'sky'}
>>> colors = attridict(data)
>>> colors
{'red': 'rose', 'blue': 'sky'}
>>> colors.red
'rose'
>>> colors["red"]
'rose'
>>> colors["red"] = "tomato"
>>> colors["red"]
'tomato'
>>> colors.red
'tomato'
```
## License
The project is MIT licensed
نحوه نصب
نصب پکیج whl attridict-0.0.6:
pip install attridict-0.0.6.whl
نصب پکیج tar.gz attridict-0.0.6:
pip install attridict-0.0.6.tar.gz