The rules come straight from CPython's dictobject.c. A dict starts with 8 slots, only two thirds are usable, and when it's full it grows to used × 3 rounded up to a power of two, so 8 becomes 16. The stored hashes are reused and every key is placed again.