[Python-ideas] Nested dictionaries

Richard Prosser richard.prosser at mail.com
Sat Mar 29 16:36:06 CET 2014


Not the first time I found myself recently needing to create
"multi-dimensional" dictionaries, so that I could write something like:

my_dict = ['a']['b']['b']['a'] = 'fred'

and once again I wonder why Python does not support that idiom directly, as
it must be a fairly common requirement. I know that there are good
solutions like the one at
http://ohuiginn.net/mt/2010/07/nested_dictionaries_in_python.html or by
using defaultdict but I feel that this really should be part of the
language.

So, should I propose a PEP?


Thanks ...

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140329/4e4b24a4/attachment.html>


More information about the Python-ideas mailing list