[Python-Dev] Re: PEP 584 underspecified

2020-05-19 Thread David Mertz
I comment on the PR.

On Tue, May 19, 2020 at 4:44 PM Brandt Bucher 
wrote:

> Maybe I'm missing something here. The PEP specifically says:
>
> > Similarly, the iteration order of the key-value pairs in the dictionary
> will follow the same semantics as the examples above, with each newly added
> key (and its value) being appended to the current sequence.
>
> That seems sufficient, no?
> ___
> 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/NM75M5N7BJOHSG3ZELIVBUNOG7ZQ3VQ4/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
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/S6EXHHRCO64F6CLEODZWLKTL4NJUVQJW/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 584 underspecified

2020-05-19 Thread Brandt Bucher
Maybe I'm missing something here. The PEP specifically says:

> Similarly, the iteration order of the key-value pairs in the dictionary will 
> follow the same semantics as the examples above, with each newly added key 
> (and its value) being appended to the current sequence.

That seems sufficient, no?
___
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/NM75M5N7BJOHSG3ZELIVBUNOG7ZQ3VQ4/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 584 underspecified

2020-05-19 Thread Guido van Rossum
Yes, the assumption (and the implementation) is that newly added keys are
inserted at the end, in the order in which the second object produces them
when iterated over. Please do send us a PR for the peps repo!

On Tue, May 19, 2020 at 12:34 PM David Mertz  wrote:

> 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 , 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/
>


-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*

___
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/IT3A33GXLAMNEMCLQTJSS5KJ7ZUSG633/
Code of Conduct: http://python.org/psf/codeofconduct/