Skip to main content

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

Or

pip install synod

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
  • keys
  • pop
  • popitem
  • setdefault
  • update
  • values

New in version 1.1:

  • items method.

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

synod-1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

synod-1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file synod-1.1.tar.gz.

File metadata

  • Download URL: synod-1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for synod-1.1.tar.gz
Algorithm Hash digest
SHA256 9c344d50cd004aba1bc8dce5b7fae3e2315c536aebddebe3bf294dcd9a54195e
MD5 8c78526fc2a5b6b1a95eb31aedcfb381
BLAKE2b-256 11e2381002c82112e4d0d4ddcfe4f1ccb80aa24e27b67b5a188e5dbc45a138b5

See more details on using hashes here.

File details

Details for the file synod-1.1-py3-none-any.whl.

File metadata

  • Download URL: synod-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for synod-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79b9bdb12107d510560751cb1a8dc2cae80e8d0ee02adf92a2a704694bcf43ae
MD5 a403a3727923290f6e1d376d41deb4a0
BLAKE2b-256 85b6c878b65a498432f70c2b6fa9d0086f0e56114386eae7b40fe567d7880b4f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page