I know this is late in the cycle to think of this.  But I just realized the
PEP 584 does not say anything about order guarantees.

I think it is safe to assume that existing keys in dictA will not have
order modified by `dictA |= dictB`.  However, the PEP does not state what
order we are given when new keys are added.  I reckon it is a kind of
insertion, so they must occur after the existing keys.  However, stating
explicitly that the MUST  (or alternately MIGHT NOT) be inserted in the
order that dictB has seems worth specifying.

Moreover, the new operator explicitly states that it will flexibly deal
with mapping types other than dict on the right hand side.  So what happens
with:

    dictA |= unorderedmapB

I think the "reasonable" belief should be that all new keys will be in some
unspecified order amongst themselves, but all occurring after the old
keys.  I think a sentence or two explicitly indicating what is promised and
what is not would be worthwhile.

>
>    -
>
>    PEP 584 <https://www.python.org/dev/peps/pep-0584/>, Union Operators
>    in dict
>
> --
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.
_______________________________________________
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/4OKQ5DARENNMKN7DVX72K46KKWO6PFCQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to