[Python-Dev] PEP for new dictionary implementation

"Martin v. Löwis" martin at v.loewis.de
Fri Feb 17 07:50:09 CET 2012


>> Good idea. However, how do you track per-dict how large the table is?
> 
> Why would you want to?
> 
> The per-instance array needs to be at least as large as the highest
> index used by any key for which it has a value; if the keys table gets
> far larger (or even shrinks), that doesn't really matter to the
> instance.  What does matter to the instance is getting a value of its
> own for a new (to it) key -- and then the keys table can tell it which
> index to use, which in turn tells it whether or not it needs to grow
> the array.

To determine whether it needs to grow the array, it needs to find out
how large the array is, no? So: how do you do that?

Regards,
Martin


More information about the Python-Dev mailing list