You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From Codon stdlib source I see it has DynamicTuple that can be initialized from the list (Codon 0.17.0).
On the other side, lists in Codon are hashable (with the hash based on all the values in the list), so they can be used as keys in maps. Any other list that is equal to the key list in the map will match.
Thanks for your answer and mentioning DynamicTuple and lists as hashable keys, which I did not know about.
However, DynamicTuple is a Codon only feature not available in regular Python. It would still be nice to have a way to convert homogenous lists to tuples to improve compatibility.
Tuples: Since tuples compile down to structs, tuple lengths must be known at compile time, meaning you can't convert an arbitrarily-sized list to a tuple, for instance.
That's why DynamicTuple exists, and why no convertion of lists to tuples.
Dear developers,
It seems to me that Codon is unable to perform a simple conversion from a list to a tuple. Here is a minimal example:
The Python output is obviously
(1, 2)
, but Codon 0.16.3 complains with this error:This is a major nuissance as, many times, lists must be converted to tuples to insert them into dicts.
The text was updated successfully, but these errors were encountered: