[Python-3000] ordered dict for p3k collections? (original) (raw)

Neville Grech Neville Grech nevillegrech at gmail.com
Sat Sep 15 18:36:51 CEST 2007


From a python's user point of view. a sorted dict/set/list was sometimes a requirement for me. Basically. a dictionary that had a BTree implementation instead of a hash table. Also. having an explicit type error would then be a clear indication that you have something wrong in your implementattion (and therefore useful indication). Other languages have separate collection frameworks like C# has powercollections. Having these collections as part of the standard library is another issue though. On 9/15/07, Arvind Singh <arvind1.singh at gmail.com> wrote:

I hope that Python gets a sorteddict and a > sortedset.

It doesn't make sense for Python to have sorteddict or sortedset. You see, dict can have keys which cannot be ordered (keys can be heterogeneous, in which case Py3K may raise TypeError; ordering doesn't make sense for the objects used as keys) and same goes for set elements. Sorting makes sense only as a run-time operation, in which case, the programmer should be prepared to handle appropriate exceptions. Btw, would you like a dict or set for which you have to handle exceptions at every insertion? -- Regards, Arvind


Python-3000 mailing list Python-3000 at python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/nevillegrech%40gmail.com

-- Regards, Neville Grech -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20070915/31b227bc/attachment.htm



More information about the Python-3000 mailing list