This is how I’d do it, yeah (a “copy-on-write” or “must rebucket” flag inside dict would do it). But it’s also an entirely internal optimization that doesn’t need to be in this PEP, provided that this PEP doesn’t guarantee that frozendict(d) is always O(N) and lock ourselves out of improving it later.[1]
Which would be a silly thing to guarantee, but hot topics like this often lead to us guaranteeing silly things because it makes people stop complaining. ↩︎