Create a gist now

Instantly share code, notes, and snippets.

Altering dictionary within ChainMap
>>> from collections import ChainMap
>>> user_context = {'name': "Trey", 'website': "http://treyhunner.com"}
>>> global_context = {'name': "Anonymous User", 'page_name': "Profile Page"}
>>> context = ChainMap({}, user_context, global_context)
>>> context['name']
'Trey'
>>> user_context['name'] = "Guido"
>>> context['name']
'Guido'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment