#Sorting a dictionary.

17 messages · Page 1 of 1 (latest)

turbid vigil
#

In the sorting of a dictionary, does the sorting of the dictionary take precedence on alphabets?

languid pumiceBOT
#

Hi Wealth👽.☂🕸 III,

Thanks for your question! It looks like you're asking a Python-related question, but your tags include C++, C, and C#. Could you update the tags to reflect that this is a Python question?

Thanks!

mint kite
cerulean bridge
#

You'd also have to define what an ordering looks like on a dictionary

#

some people sort the tuples of (key, value), others just sort based on the key

#

some others sort by insertion order

cerulean bridge
mint kite
cerulean bridge
#

For sorted yes

#

if you explicitly sort

#

if you don't do anything the entries are sorted by insertion order (changed in idk some relatively recent 3.X version)

#

3.7 I think?

mint kite
#

Oh I thought they were referring to actually sorting on the dictionary

cerulean bridge
#

maybe, in that case it's sorting keys with cmp or whatever

#

(I believe?)

#

ig the question is hinting at ducts with string keys so there it's alphabetical

turbid vigil
#

Yes in python