If we execute fd = frozendict(d), can’t we make make d point to the hash table of fd and only copy it when we add, change or remove a key (but not when we clear the dict). That would give us O(1) construction without changing the class and would also work for d = dict(fd).
5 Likes