Does OrderedDict from collections module work in Dynamo?

Hello,

Does anyone know if OrderedDict, from collections module, could be used in Dynamo?
OrderedDict

Desired output: (‘a’, 1), (‘b’, 2), (‘c’, 3)
Example is from: python - OrderedDict Isn’t Ordered? - Stack Overflow
Thank you in advance!

Hi @cavitcanyilmaz !
In Dynamo a dictionary is not ordered (I think in Python it is not really ordered, it just looks like). But you can get an ordered list based on the dictionary components that way

1 Like

Hello
OrderedDict works fine inside Python node.
However, for better compatibility with other nodes the dynamo wrapper converts the Python dictionary into Net Dictionary (which is not ordered) Net SortedDictionary is not used

1 Like

@c.poupin

Thank you for the help :slight_smile:

I had a feeling something above my level was going on. Thank you for help :slight_smile:

1 Like

Hello
with version 2.04 (Revit 2019 and lower) we need cast python dictionary to Net Dictionary at the OUT variable (Dynamo Wrapper)

2 Likes