August 2018
Intermediate to advanced
366 pages
10h 14m
English
If you have ever need to provide a reverse mapping, you have probably discovered that Python lacks a way to store more than a value for each key in a dictionary. This is a very common need, and most languages provide some form of multimap container.
Python tends to prefer having a single way of doing things, and as storing multiple values for the key means just storing a list of values for a key, it doesn't provide a specialized container.
The issue with storing a list of values is that to be able to append to values to our dictionary, the list must already exist.