a question on python dict
Tim Peters
tim.one at comcast.net
Sun Dec 31 07:27:44 EST 2006
[Tim Peters]
>>>> You should also note that copying a dict key or value (no matter of
>>>> what type) consists in its entirety of copying one machine address (a
>>>> 4- or 8-byte pointer, depending on platform).
[Lawrence D'Oliveiro]
>>> Actually, no. It also consists of updating reference counts as well.
[Tim Peters]
>> Not in context: dict resizing is refcount-neutral...
[Lawrence D'Oliveiro]
> The question wasn't about resizing, it was about "copying a dict key or
> value".
Then you misunderstood the OP. He was asking about dict resizing:
...
When there are more and more items being added to the
hashtable, it increase its buckets and copy the old items into the
new one and re-calculate the hash value of each item.
I think this will waste some time doing the increasing-copying
thing.
Taking my response out of context to begin with doesn't really change that
I answered the question he asked ;-)
More information about the Python-list
mailing list