Pseudo-Immutable Dictionaries in Python

2013 Jan03

very so often a situation arises where you need to keeps some small bits of data around where you know the value, and want to ensure that it won't get fudged with in the lifespan of the application. Say, for example, you want to map some Classes to some known values for quick lookup to dynamically generate some output - [Like a dynamic django form](/2012/05/05/dynamic-django-modelforms/) In other words, you want [ENUMS](

Python doesn't have an implementation for ENUMS, and most of the standard data types are mutable, which doesn't sit well in this situation. Usually, the python swiss army knife - The Dictionary is a one size fits

Read More