Skip to content

MrS0m30n3/twodict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twodict (Two Way Ordered Dict)

Simple two way ordered dictionary for Python.

See wiki for more information.

INSTALLATION

Install From Source

  1. Download & extract source from here
  2. Change directory into twodict-1.2/
  3. Run sudo python setup.py install

Install From Pypi

  1. Run sudo pip install twodict

USAGE

from twodict import TwoWayOrderedDict

tdict = TwoWayOrderedDict()
tdict['a'] = 1
tdict['b'] = 2
tdict['c'] = 3

print(tdict['a'])  # Outputs 1
print(tdict[1])  # Outputs 'a'

del tdict[2]
print(tdict)  # TwoWayOrderedDict([('a', 1), ('c', 3)])

AUTHOR

Sotiris Papadopoulos

LICENSE

Unlicense (public domain)