[Python-ideas] Have dict().update() return its own reference.

Masklinn masklinn at masklinn.net
Fri Apr 20 21:49:10 CEST 2012


On 2012-04-20, at 20:30 , Victor Varvariuc wrote:

>>>> a = {}
>>>> b = {1:2}
>>>> dict(a, **b)
> 
> If b is a huge dict - not a good approach

If they're huge mappings, you probably don't want to go around copying
them either way[0] and would instead use more custom mappings, either
some sort of joining proxy or something out of Okasaki (a clojure-style
tree-based map with structural sharing for instance)

[0] I'm pretty sure "being fast to copy when bloody huge" is not at the
    forefront of Python's dict priorities.



More information about the Python-ideas mailing list