Victor Hooi wrote: > Aha, yeah, I can add the connection_id as another field in the inner dict > - the only drawback is that the data is duplicated twice. However, I > suppose even if it's not elegant, it does work.
The elegance lies in its simplicity, so it's still my personal favourite. > However, that ChainMap does look interesting =). And yes, I am actually > using Python 3.x (mainly because of http://bugs.python.org/issue6641). > > So if I understand correctly, I can just use ChainMap to join any > arbitrary number of dicts together - it seems like the right solution > here. > > Are there any drawbacks to using ChainMap here? (Aside from needing Python > 3.x). As it introduces another level of indirection it costs a little time, but compared to the actual I/O that should be negligible. So no, if there is a drawback I don't see it. -- https://mail.python.org/mailman/listinfo/python-list