Gustavo Narea <m...@gustavonarea.net> writes:

> I've been searching for a data structure like a tuple/list *but*
> unordered -- like a set, but duplicated elements shouldn't be removed.

By that description, you're looking for the “Bag” pattern.

[…]
> A multiset is not exactly what I need: I still need to use the
> elements in the order they were given.

This appears to contradict your explicit request that the collection
type be unordered.

[…]
> To sum up, it would behave like a tuple or a list, except when it's
> compared with another object: They would be equivalent if they're both
> unordered tuples/lists, and have the same elements. There can be
> mutable and immutable editions (UnorderedList and UnorderedTuple,
> respectively).

Okay, so you want something rather special; it would be misleading to
call this an unordered type, since you *do* want ordering preserved.
It's only the comparison operators that would ignore ordering.

AFAIK you'll need to design and implement this yourself.

> I will write a PEP to elaborate on this if you think it'd be nice to
> have. Or, should I have written the PEP first?

Either way; but I think this discussion belongs on ‘python-ideas’ while
the behaviour is still being designed.

-- 
 \      “On the internet you simply can't outsource parenting.” —Eliza |
  `\      Cussen, _Top 10 Internet Filter Lies_, The Punch, 2010-03-25 |
_o__)                                                                  |
Ben Finney

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to