[Python-3000] ordered dict for p3k collections? (original) (raw)
Nicholas Bastin nick.bastin at gmail.com
Sun Sep 16 03:53:48 CEST 2007
- Previous message: [Python-3000] ordered dict for p3k collections?
- Next message: [Python-3000] ordered dict for p3k collections?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
How do you get from "some keys can't be ordered" to "it doesn't make sense for Python to have sorteddict or sortedset"? If you want to use keys that can't be ordered, then feel free to continue to use dict. For situations in which ordering is important, that language should support that. When did this become an all or nothing proposition? There's plenty of space for both dict and sorteddict.
Btw, would you like a dict or set for which you have to handle exceptions at every insertion?
Yes, if that's what the situation calls for.
-- Nick
- Previous message: [Python-3000] ordered dict for p3k collections?
- Next message: [Python-3000] ordered dict for p3k collections?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]