On Thu, Oct 18, 2012 at 1:18 PM, Prasad, Ramit
<ramit.pra...@jpmorgan.com> wrote:
> Why does pointer arithmetic work for dicts? I would think the position
> of a value would be based on the hash of the key and thus "random" for
> the context of this conversation.

It doesn't.  len() on CPython dicts is O(1) because the dict keeps
track of how many items it contains.  It needs to do this anyway so
that it can determine when to grow the internal hash table.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to