[Python-Dev] PySequence_Concat for dicts

Raymond Hettinger python at rcn.com
Sat Jan 12 02:21:16 CET 2008


> I wasn't suggesting that the result of concatenation would 
> be a  chained table, rather that it would perform the 
> equivalent of an  update and return the new dict 
>(the same way extend works for lists)

When does it come-up that you want a third summed dict 
while keeping the two originals around unchanged?  Does
it matter that the addition is non-commutative?  Would
a + b + c produce an intermediate a/b combo and then
another new object for a/b/c so that the entries in
a get copied twice and memory usage has to hold a, b,
a/b, c, and a/b/c in memory all at the same time?  
What are the use cases?

FWIW, the Py3.0 API for dicts will support some set-like
operations.  Perhaps, that fits the bill.


Raymond


More information about the Python-Dev mailing list