Post AWuV4QPqFSfVjycOlE by abbienormal@floss.social
 (DIR) More posts by abbienormal@floss.social
 (DIR) Post #AWuV4OSbWDgpfxtZmy by abbienormal@floss.social
       2023-06-21T07:47:43Z
       
       0 likes, 0 repeats
       
       I'm pretty printing some dictionaries (mappings) in #python in order to gauge the layout in a clear formI don't like the order the keys are printed in Can I do anything about that ?
       
 (DIR) Post #AWuV4PQVvTc0flvQAa by cnx@larkspur.one
       2023-06-21T08:21:57.504480Z
       
       0 likes, 0 repeats
       
       @abbienormal, you’ll need to sort the pairs every time you print.  Tim sort (used by sorted) is pretty fast, but in case it becomes a performance bottle neck somehow, you’ll probably have to result to wrapping C++’s map or implement an equivalence.  If the dict is not growing you can overwrite it just once (as dict order is preserved since CPython 3.7).
       
 (DIR) Post #AWuV4QPqFSfVjycOlE by abbienormal@floss.social
       2023-06-21T07:57:33Z
       
       0 likes, 0 repeats
       
       I'd also like to order a list of dictionaries based on one of their valuesIs that possible ?