[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Compact ordered set

On Feb 26, 2019, at 13:02, Raymond Hettinger <raymond.hettinger at gmail.com> wrote:

> * I gave up on ordering right away.  If we care about performance, keys can be stored in the order added; but no effort should be expended to maintain order if subsequent deletions occur.  Likewise, to keep set-to-set operations efficient (i.e. looping over the smaller input), no order guarantee should be given for those operations.  In general, we can let order happen but should not guarantee it and work to maintain it or slow-down essential operations to make them ordered.

One thing that concerns me would be if the ordering for sets is different than dictionaries.  Well, it kind of is already, but it?s easier to say ?dict preserve insertion order, sets are unordered?, than to say they are both ordered but with different guarantees.  The behavior differences between dicts and sets is already surprising to many users, so we should be careful not to make the situation worse.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190226/73c7195c/attachment.sig>