-
Notifications
You must be signed in to change notification settings - Fork 62
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
cable_global_properties.catalogue
assignment changes iteration order, is surprising
#1879
Comments
cable_properties.catalogue
assignment creates copy, and is surprisingcable_global_properties.catalogue
assignment creates copy, and is surprising
cable_global_properties.catalogue
assignment creates copy, and is surprisingcable_global_properties.catalogue
assignment changes iteration order, is surprising
Hi, That said, never rely on
The solution should be to use |
What can be done to make this less surprising then? Can we sort the iteration on the CPP side? Alphabetic ordering of the mechs seems like a good user experience. |
Have you tried using for m in sorted(cat):
print(m) For me that gives a alpha-sorted list
|
I'm sure that works, but should a user have to know to have to do that? However you make a user aware of this, it's an additional burden, and software rife with things like this is not fun to use. |
Describe the bug
When assigning to the
catalogue
property of acable_global_properties
object, it seems to create and store a copy of the original object, which has some surprising side effects: it invalidates and shuffles the otherwise seemingly deterministic order of the mech cat iterator:Context
Whilst @thorstenhater will probably argue that it is a bag, or a set, or a dragon, and order is not guaranteed 😉 it is still an open trapdoor since users (read: me (and @noraabiakar )) build up an assumption through use of the catalogues and its iterators, that the order is preserved. When then accessing the "same" catalogue through
recipe.properties.catalogue
for example, another iteration order is obtained. This led to catastrophy in the benchmarks, where the recorded samples and mechanism label were mismatched when zipped together.Please do not propose to shuffle the return results of the mech cat iterator 👉 👈
The text was updated successfully, but these errors were encountered: