a question on python dict
Tim Peters
tim.one at comcast.net
Sun Dec 31 03:30:57 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.
Not in context: dict resizing is refcount-neutral, and the CPython
implementation of dict resizing exploits that (quite directly in 2.5;
indirectly before 2.5). It's not just that refcounts end up the same
/across/ dict resizing, it's that they're not changed internally either for
the duration of the resizing operation.
More information about the Python-list
mailing list