Skip to content

Instantly share code, notes, and snippets.

View treygriffith's full-sized avatar

Trey Griffith treygriffith

View GitHub Profile
@treygriffith
treygriffith / immutable_dict.py
Created October 18, 2014 18:44
An Immutable Dictionary in python - a tuple with real keys
class ImmutableDict:
"""A tuple with non-index keys"""
def __init__(self, dict):
self._keys = tuple(dict.keys())
self._values = tuple(dict.values())
def __len__(self):
return len(self._keys)