3 ms·
The problem is that once this side effect is in the main version for a while, it becomes a feature whether you admit it or not. Since that is going to happen an
by gizmo686 1y ago
The problem is that once this side effect is in the main version for a while, it becomes a feature whether you admit it or not. Since that is going to happen anyway, you might as well make it official.
The alternative approach is to do what Go did and explicitly randomize iteration order to prevent people from relying on a fixed order in the first place.
- jamesdutc 1y ago> explicitly randomize iteration In fact, we see this with CPython `set`, controlled by `_Py_HashSecret`: https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41/Python/initconfig.c#L1763 https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b... https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41/Python/pylifecycle.c#L507 https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b... https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41/Python/bootstrap_hash.c#L553 https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b... https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41/Python/pyhash.c#L17 https://github.com/python/cpython/blob/6eb6c5dbfb528bd07d77b...