malramsay64 / experi

An interface for managing computational experiments with many independent variables.
MIT License
4 stars 1 forks source link

Deterministic ordering in python < 3.6 #14

Open malramsay64 opened 6 years ago

malramsay64 commented 6 years ago

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 commented 6 years ago

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