Python multimap

Carl Banks pavlovevidence at gmail.com
Thu Aug 28 21:28:19 CEST 2008


On Aug 28, 2:41 pm, brad <byte8b... at gmail.com> wrote:
> Carl Banks wrote:
> > Out of curiosity, what does a true multimap solve that a dictionary of
> > lists not solve?
>
> Nothing really. I went with a variation of the suggested work around...
> it's just that with Python I don't normally have to use work arounds and
>   normally one obvious approach is correct:

Might I suggest that the C++ multimap is the workaround, rather than
the Python way of using dicts or lists or dicts of sets?

It was too much programming overhead and line noise confusion to
define nested templates to hold your nested data structures in C++, so
the STL provided a container that eliminated the nesting.  In Python,
the obvious nested way to do it is easy, especially now with
defaultdicts, so there was no reason to provide a multimap.


Carl Banks



More information about the Python-list mailing list