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

Nathaniel Smith njs at pobox.com
Fri Feb 6 02:17:01 CET 2015


On Thu, Feb 5, 2015 at 5:12 PM, Ed Kellett <edk141 at gmail.com> wrote:

On Fri Feb 06 2015 at 12:12:19 AM Steven D'Aprano <steve at pearwood.info> wrote:

I think there are plenty of other major design decisions to be made. What's the union between a regular set and an ordered set? Is there a frozen ordered set? Do ordered sets compare unequal if they differ only in order (like lists)? Are there many options for the union question? I think the only sane choice for any union involving ordered sets is an unordered set - in any other case the resulting order would be wrong or at least not obviously right, and that's almost certainly better expressed explicitly.

Surely a.union(b) should produce the same result as a.update(b) except out-of-place, and .update() already has well-defined semantics for OrderedDicts.

-n

-- Nathaniel J. Smith -- http://vorpus.org



More information about the Python-ideas mailing list