[Python-Dev] Rehashing in PyDict_Copy

Raymond Hettinger python@rcn.com
Thu, 29 Aug 2002 15:21:46 -0400


Is there a reason that dict.copy() runs like an update()?
It creates a new dict object, then re-hashes and inserts
every element one-by-one, complete with collisions.

I would have expected a single pass to update refcounts,
an allocation for identical size, and a memcpy to polish
it off.

Raymond