Ancestors

Toot

Written by Paul van der Laan on 2025-01-15 at 08:10

[#]Python question: since dictionaries are ordered in Python 3 now, are there any reasons to still use OrderedDicts? I'm updating some old code that was written in Python 2 originally.

=> More informations about this toot | More toots from paulvanderlaan@typo.social

Descendants

Written by Just van Rossum on 2025-01-15 at 08:35

@paulvanderlaan if “preserve insertion order” is good enough, then there’s no reason to use an OrderedDict.

=> More informations about this toot | More toots from justvanrossum@typo.social

Written by Paul van der Laan on 2025-01-15 at 09:17

@justvanrossum I figured as much. Thanks.

=> More informations about this toot | More toots from paulvanderlaan@typo.social

Written by Alexandre B A Villares 🐍 on 2025-01-16 at 09:43

@paulvanderlaan and what @justvanrossum 's reply implies is that if you need more stuff like efficiency in dealing with ordering, it still has more features, like..move_last() not available on common dicts. https://docs.python.org/3/library/collections.html#collections.OrderedDict

=> More informations about this toot | More toots from villares@ciberlandia.pt

Written by C. on 2025-01-15 at 23:26

@paulvanderlaan

Nope, they're just there for backward compatibility. Convert away!

[#]legacy

=> More informations about this toot | More toots from cazabon@mindly.social

Written by Alexandre B A Villares 🐍 on 2025-01-16 at 09:44

@cazabon @paulvanderlaan not really, they still have more stuff... https://docs.python.org/3/library/collections.html#collections.OrderedDict

=> More informations about this toot | More toots from villares@ciberlandia.pt

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113831355359533734
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
268.282648 milliseconds
Gemini-to-HTML Time
1.276247 milliseconds

This content has been proxied by September (3851b).