Little bit better than dict
Project description
Description
Like dict, but a little bit better
install
pip install dictones
import
from dictones import DictOnes
Usage
1. Added constructor
filled_dict = DictOnes('first_key, second_key', 'to first key', 'to second key')
print(filled_dict.first_key)
print(filled_dict.second_key)
Output
'to first key'
'to second_key'
2. Constructor without filling
filled_dict = DictOnes('first_key, second_key')
print(filled_dict.first_key)
print(filled_dict.second_key)
print(filled_dict.key)
Output
None
None
...raise KeyError(attrname)
KeyError: 'key'
3. Deleting
filled_dict = DictOnes('first_key, second_key')
print(filled_dict.first_key)
print(filled_dict.second_key)
print('second_key' in filled_dict)
del filled_dict.second_key
print('second_key' in filled_dict)
Output
None
None
True
False
Otherwise it is the same 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 Distribution
dictones-0.1.1.tar.gz
(24.8 kB
view hashes)
Built Distribution
dictones-0.1.1-py3-none-any.whl
(35.3 kB
view hashes)