Guarantee consistent order of pairs, keys and values in Dicts #28196
Labels
domain:collections
Data structures holding multiple items, e.g. sets
domain:docs
This change adds or pertains to documentation
There are multiple ways to iterate a
Dict
. The functionskeys(dict)
andvalues(dict)
are guaranteed to return items in a consistent order, as stated in the docs (https://docs.julialang.org/en/latest/base/collections/#Base.keys):This is of course assuming that the
Dict
has not been modified in between. However it is not asserted thatfor (k,v) in dict ...
also iterates items in the same order askeys(dict)
andvalues(dict)
. If this is guaranteed, it should be mentioned in the docs.The text was updated successfully, but these errors were encountered: