3 ms·
The point is that freeze could work in constant time, whereas the copying takes linear time. Another alternative mentioned was `move`, which would create a fro
by emil-lp 11mo ago
The point is that freeze could work in constant time, whereas the copying takes linear time.
Another alternative mentioned was `move`, which would create a frozen version in constant time and clear the original dict.
- shadowgovt 10mo agoFreeze can't work in constant time if it builds a hash when the dict is frozen so that the dict can be used as a key. If all it does is set a flag that prevents modifications, that's different.