Managing (aka. cleaning up) a nested dictionary in Python
We are storing configurations. Let’s assume we are working on a store and we want to save prices for different products. But there are a set of configurations we have to consider1: We are working over multiple countries. Every country has got some locations. Every location has a set of articles. For an article, I might have multiple sizes. Finally, for every size I have got prices. Now let’s say that we want to store all of that in a Python dictionary. Luckily, the set of options is not too large, so that we can easily store it in a nested dictionary, which looks something like that: ...