[Python-ideas] PEP: Dict addition and subtraction

Brandt Bucher brandtbucher at gmail.com
Fri Mar 22 13:26:07 EDT 2019


>> On Mar 21, 2019, at 16:55, Steven D'Aprano <steve at pearwood.info> wrote:
>> 
>> On Thu, Mar 21, 2019 at 03:10:48PM -0700, Brandt Bucher wrote:
>> For anyone interested in "trying it out": if you're not against cloning and
>> compiling CPython yourself, here is a PEP 584 C implementation I have PR'd
>> against master right now. I'm keeping it in sync with the draft PEP as it
>> changes, so subtraction performance is not overly optimized yet, but it
>> will show you the *exact* behavior outlined in the PEP on the dict builtin
>> and its subclasses. The relevant branch is called "addiction". You can
>> clone it from:
> 
> That's great, thank you!
> 
> For the sake of comparisons, could you support | as an alias? That will 
> allow people to get a feel for whether a+b or a|b looks nicer.
> 
> 
> (For the record, the PEP isn't set in stone in regards to the choice of 
> operator.
> 
>> https://github.com/brandtbucher/cpython.git

Great idea. I just added this, and all tests are passing.

For reference, here’s the PR (it’s linked to the BPO, too):

https://github.com/python/cpython/pull/12088
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190322/1bd27791/attachment.html>


More information about the Python-ideas mailing list