Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deterministic ordering in python < 3.6 #14

Open
malramsay64 opened this issue Feb 6, 2018 · 1 comment
Open

Deterministic ordering in python < 3.6 #14

malramsay64 opened this issue Feb 6, 2018 · 1 comment

Comments

@malramsay64
Copy link
Owner

Python 3.6 introduced a new dictionary implementation which retains order of insertion. This means
that the ordering of the dictionary and consequently the ordering of variable iteration is
deterministic.

In versions prior to this the ordering of variable iteration can vary between instances run.
This manifests itself as variation in ordering of commands, the difference between

echo 1 1
echo 1 2
echo 1 3
echo 2 1
echo 2 2
echo 2 3

and

echo 1 1
echo 2 1
echo 1 2
echo 2 2
echo 1 3
echo 2 3

This primarily poses an issue with testing, although it would be nice to remove random elements.

@malramsay64
Copy link
Owner Author

The appropriate data structure might be a named tuple since this also adds immutability which is currently assumed with the dict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant