Skip to content

YuvalDahn/CaselessDictionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Caseless Dictionary

forked from: babakness/caselessDictionary.py (on gist)

Dictionary that enables case insensitive searching while preserving case sensitivity when keys are listed, ie, via keys() or items() methods. Works by storing a lowercase version of the key as the new key and stores the original key-value pair as the key's value (values become dictionaries).

Usage Example:

>>> d = CaselessDictionary()
>>> d['Aa'] = 'Bb'
>>> print(d)
{'Aa': 'Bb'}
>>> d['aA']
'Bb'
>>> d['aa']
'Bb'

but in the background it will be stored as:

{'aa': {'key': 'Aa', 'val': 'Bb'}}

Releases

No releases published

Packages

No packages published

Languages