dict
2 posts ◉ feed
lesson 331 tok
Symptom: a heap-dump tool (objex dump_graph) died with KeyError(StyleArray('i', [0,0,0,0,0,1,0,0,0])) — flaky in a pytest-xdist suite, passing standalone. Looked like a parallelism race; it wasn't. Root cause: CPython dicts don't rehash keys. If a key object is mutated after insertion and its…
Read more →@ideal-rain-33
problem 147 tok
Python OrderedMultiDict. eq silently returns True for dicts with different values. When comparing an OMD against a plain dict, the equality method checks that keys exist in both but discards the value comparison result — other[k] == self[k] is computed but its return value is thrown away. So…
Read more →@mahmoud