On Tue, 24 Dec 2019 12:08:33 +0900
"Stephen J. Turnbull" <turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> David Mertz writes:
> 
>  > Even though I was the first person in this thread to suggest
>  > collections.OrderedSet, I'm "meh" about it now. As I read more and played
>  > with the sortedcollections package, it seemed to me that while I might want
>  > a set that iterated in a determinate and meaningful order moderately often,
>  > insertion order would make up a small share of those use cases.  
> 
> On the other hand, insertion order is one of the most prominent of the
> determinate meaningful orders where you would have to do ugly things
> to use "sorted" to get that order.  Any application where you have an
> unreliable message bus feeding a queue (so that you might get
> duplicate objects but it's bad to process the same object twice) would
> be a potential application of insertion-ordered sets.

In that case you probably want a separate persistent "seen" set.
Because your queue can have been drained by the time a duplicate object
arrives.

(which means you probably want something more efficient, such as a
sequence number)

Regards

Antoine.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/QANSVP7LU4OVMGKIGM25CJ4W24YYYVBD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to