Nice that this has been fixed!
Any plans on making dictionaries a native data type in Grasshopper?
I use the trick of passing dictionaries in a list from python A LOT, but it always seems hacky…
Dictionaries are such a clean and efficient way of organizing data, compared to multiple parallel lists or trees. Especially when working several people in the same script.
Classic example:
I import some objects from Rhino, they have user text on them that give me some individual settings for the GH algoritm.
In GH I want to have a clean code where the settings and geometry flow along together and in sync.
The standard GH way seems to be to pass multiple lists in parallel or make a data tree (neither of which are clean solutions).
I then have to keep track of all settings by index instead of name, which is a nightmare when cooperating on scripts.
The dictionary hack mentioned allows me to collect each object as one dictionary in python, with each setting as a key-value pair.
When I pass it along in GH as a list, each item in the list is a dictionary including all I want (and allows me to avoid complex data trees).
In related threads like this one it’s suggested to make a class instead.
This works, and I can put the settings and geometry as attributes on an instance, but I then have to define a class in each python component creating these instances.
Since dictionaries is such an established system, that enables very clean data structures, I really miss it in the native GH system…