
But that’s in insertion order, not in key order right? I think we need data structure that are key-ordered.
On 10 Nov 2021, at 00:23, Hasan Diwan hasan.diwan@gmail.com wrote:
On Tue, 9 Nov 2021 at 16:01, Bob Fang <boyufang@bytedance.com mailto:boyufang@bytedance.com> wrote: This is a modest proposal to consider having sorted containers (http://www.grantjenks.com/docs/sortedcontainers/ https://t.mailpgn.com/l/?u=5264d942-a595-49ac-a64a-986ce181d7fb&fl=https%3A%2F%2Ft.mailpgn.com%2Fl%2F%3Fu%3Da3e560c9-4417-427b-b976-19746738d8e5%26amp%3Bfl%3Dhttp%253A%252F%252Fwww.grantjenks.com%252Fdocs%252Fsortedcontainers%252F) in standard library. I know that usually adding stuff to standard library requires some strong arguments, so I will try my best to give my reasons here:
As of 3.7. dicts are sorted[1], but I'm unsure if the order can be overridden. Indeed:
Boys = {'Tim': 18,'Charlie':12,'Robert':25}
Girls = {'Tiffany':22}
print(cmp(Girls, Boys))
Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'cmp' is not defined
Girls.__gt__(Boys)
NotImplemented
-- H
OpenPGP: https://hasan.d8u.us/openpgp.asc https://t.mailpgn.com/l/?u=b8770bd0-a9ef-411d-8c87-1636e6d9b77a&fl=https%3A%2F%2Ft.mailpgn.com%2Fl%2F%3Fu%3D5a3f5883-7b16-4b11-80ad-be68170836a1%26amp%3Bfl%3Dhttps%253A%252F%252Fhasan.d8u.us%252Fopenpgp.asc If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest https://t.mailpgn.com/l/?u=8467f9a6-914d-4d6d-8c00-dd503e667146&fl=https%3A%2F%2Ft.mailpgn.com%2Fl%2F%3Fu%3D20c36f1d-4104-40d6-8c5e-b8bee61caaa4%26amp%3Bfl%3Dhttp%253A%252F%252Fbit.ly%252Fhd1AppointmentRequest. Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest https://t.mailpgn.com/l/?u=be22c143-79b8-4a2b-b7f9-cb7a95a8e7e4&fl=https%3A%2F%2Ft.mailpgn.com%2Fl%2F%3Fu%3D143cb038-fda7-4317-aef6-37d17da9dfde%26amp%3Bfl%3Dhttp%253A%252F%252Fbit.ly%252Fhd1AppointmentRequest.
https://t.mailpgn.com/l/?u=b065018c-6b50-41c8-9881-508f9f2f30fa&fl=https%3A%2F%2Ft.mailpgn.com%2Fl%2F%3Fu%3D9c5843eb-43ed-470a-83fc-1ca514c43810%26amp%3Bfl%3Dhttps%253A%252F%252Fsks-keyservers.net%252Fpks%252Flookup%253Fop%253Dget%2526amp%253Bsearch%253D0xFEBAD7FFD041BBA1Sent from my mobile device Envoye de mon portable
- https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/ https://t.mailpgn.com/l/?u=e7d71732-691a-421f-b43a-a9cdb3c2b9d0&fl=https%3A%2F%2Fsoftwaremaniacs.org%2Fblog%2F2020%2F02%2F05%2Fdicts-ordered%2F_______________________________________________
Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/RNXTH3JR... Code of Conduct: http://python.org/psf/codeofconduct/