This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients brandtbucher, gvanrossum, ncoghlan, rhettinger, serhiy.storchaka
Date 2021-07-23.01:09:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627002576.87.0.902766966205.issue43838@roundup.psfhosted.org>
In-reply-to
Content
I believe that delegating to the actual underlying mapping without exposing it is a bit of a lost cause, since for some type m we still need these to work:

>>> types.MappingProxyType(m({"a": 0)) | types.MappingProxyType(m({"b": 1}))
m({'a': 0, 'b': 1}) 
>>> types.MappingProxyType(m({"a": 0)) == types.MappingProxyType(m({"a": 0}))
True

(Note that because both sides are proxies, it's impossible for any resolution to happen without m explicitly knowing how to handle them unless both mappings are unwrapped simultaneously.)

Instead, the attached PR delegates to a *copy* of the underlying mapping for these operations instead. I think this is the easiest way to approximate the current behavior while maintaining proper encapsulation.
History
Date User Action Args
2021-07-23 01:09:36brandtbuchersetrecipients: + brandtbucher, gvanrossum, rhettinger, ncoghlan, serhiy.storchaka
2021-07-23 01:09:36brandtbuchersetmessageid: <1627002576.87.0.902766966205.issue43838@roundup.psfhosted.org>
2021-07-23 01:09:36brandtbucherlinkissue43838 messages
2021-07-23 01:09:36brandtbuchercreate