Python dictionary with synonyms
Project description
synod by Gnifajio
Python dictionary with synonyms
Description
Python does not support the list type as a dictionary key, and there are more synonyms. I solved this problem by creating my own synod data type that allows me to do this. Below is an example of how it works.
Installation
git clone https://github.com/gnifajio/synod.git
cd synod
python3 setup.py install
Usage
from synod import synod
synoded = synod([
[['development', 'dev'], [
'all_inclusive', 'backend', 'frontend',
'prototyping', 'android', 'desktop',
'1c_dev', 'games', 'other', 'scripts',
'voice_interfaces', 'ios', 'bots',
]],
[['testing', 'tst'], [
'sites', 'mobile', 'software',
]],
[['admin', 'adm'], [
'servers', 'network', 'databases',
'security', 'other' ,
]]
]
)
synoded['dev'] == synoded['development'] # True
'dev' in synoded # True
synoded.get('wtf') # synod.EmptyValue
synoded.get('testing') # [ 'sites', 'mobile', 'software' ]
synoded.has_key('tst') # True
synoded.is_synonym('adm') # True
synoded.get_main_key('adm') # 'admin'
del synoded['dev']
synoded.has_key(dev) # False
synoded.clear()
synoded # {}
TODO
Add Methods:
__ior__
__iter__
__len__
__or__
__reversed__
__ror__
__setitem__
copy
fromkeys
items
keys
pop
popitem
setdefault
update
values
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
synod-1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
synod-1.0-py3-none-any.whl
(3.8 kB
view hashes)