On 24.08.2020 22:43, Cade Brown wrote:
> I would like to suggests that `set` objects are ordered by insertion, so that:
>   * Sets have a defined, repeatable order for maximum reproducibility 
> (assuming
> the code generates the set in a stable way)
>   * Tests which are outside of Python can do string comparisons and expect the
> same output each time (as with `dict` objects generated in a predictable way).
>   * On a high-level note, Python specifies more exact behavior. It is my 
> belief
> (and I'm sure many others share this as well) that
> unspecified/implementation-dependent/otherwise-undependable features should be
> eliminated and replaced with exact semantics that do not suprise users.

Why don't you simply use dicts instead of sets in case you want to
benefit from the insert order feature ?

Note that there were good reasons for having dict come closer to
OrderedDict - dicts are used by the interpreter to manage
namespaces and namespace definitions are ordered in Python code
(they are read top to bottom, or left to right).

It was desirable to have access to this order to reduce the number of
hacks necessary to gain this information before Python 3.7.

Sets aren't used in such a way. Their main purpose is to make
membership tests fast, even when the set content changes
frequently.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Aug 25 2020)
>>> Python Projects, Coaching and Support ...    https://www.egenix.com/
>>> Python Product Development ...        https://consulting.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               https://www.egenix.com/company/contact/
                     https://www.malemburg.com/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SXAWISPKK2IKNCIWKCHENPUU6P6ZNIQC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to