I think the set operation of dict_keys accepts any iterable by accident. There is an issue for it: https://bugs.python.org/issue38538
On Wed, Dec 4, 2019 at 4:32 PM Serhiy Storchaka <storch...@gmail.com> wrote: > > 03.12.19 21:04, Andrew Barnert via Python-ideas пише: > > On Dec 3, 2019, at 02:00, Serhiy Storchaka <storch...@gmail.com> wrote: > >> What it will return if implement | for dicts? It should be mentioned in > >> the PEP. It should be tested with a preliminary implementation what > >> behavior is possible and more natural. > > > > What is there to document or test here? There’s no dicts involved in either > > operator, only a set and a key view, both of which are set types and > > implement set union. > > Oh, sorry, it was a wrong example. Here is the right one: > > >>> {(1, 2): 3}.keys() | {4: 5} > {(1, 2), 4} > > > > >>> {4: 5} | {(1, 2): 3}.keys() > {(1, 2), 4} > > > > > How the results will change after implementing PEP 584? It all should be > considered in the PEP. Note that dictkeys.__or__ does not return > NotImplemented (there is an issue for this), so the PEP can require more > wider changes than just adding __or__, __ror__ and __ior__ to dict. > _______________________________________________ > 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/OYUGN5FOIQGEHS5XJFGHNLQO4AUJMUON/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Inada Naoki <songofaca...@gmail.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/ETRZMH6T4JTMNFCTXO6Q4S5ZCIB2CKK4/ Code of Conduct: http://python.org/psf/codeofconduct/