[Python-ideas] Add orderedset as set(iterable, *, ordered=False) and similarly for frozenset.

Sturla Molden sturla.molden at gmail.com
Sun Feb 8 16:56:23 CET 2015


Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:

> I thought ordered sets were interesting enough to write an implementation
> six years ago, but frankly there are many other other things that have a
> much better case for being added to collections (for example, some sort
> of graph structure, some kind of binary tree, some kind of trie, or
> perhaps a bloom filter).

We could use a SortedDict and a SortedSet implemented as binary search
trees. They should have the same interface as set and dict, but also allow
slicing and query method for extracting ranges of keys.

Personally I doubt the usefulness of OrderedDict and OrderedSet.

Sturla



More information about the Python-ideas mailing list