Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Christopher Barker
Oops, meant for the list: > >> > >> > Chris seems to accept that sometimes you can use a dict subclass, and > >> > that my proposal will give some representation of "practical > >> > experience". > >> > >> I said "definitely won't", not "will give some". So, no. > > > > > > Jonathan: Chris A. is r

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Brandt Bucher
>> On Mar 21, 2019, at 16:55, Steven D'Aprano 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

Re: [Python-ideas] Dict joining using + and +=

2019-03-22 Thread Serhiy Storchaka
04.03.19 15:43, Serhiy Storchaka пише: 01.03.19 12:44, Steven D'Aprano пише: On Fri, Mar 01, 2019 at 08:47:36AM +0200, Serhiy Storchaka wrote: Also, if the custom dict subclass implemented the plus operator with different semantic which supports the addition with a dict, this change will break

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-22 Thread Paul Moore
On Fri, 22 Mar 2019 at 07:46, Terry Reedy wrote: > On 3/22/2019 12:53 AM, Steven D'Aprano wrote: > > If a+b already worked for dicts, would you still prefer {**a, **b}? > > Example: {**sys.modules, **globals()} > > Aside from the fact that I can patch *and* backport to 3.7 *now*, I > think so. T

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Steven D'Aprano
On Fri, Mar 22, 2019 at 07:59:03AM +, Jonathan Fine wrote: > Steven D'Aprano wrote: > > > (For the record, the PEP isn't set in stone in regards to the choice of > > operator. > > Steven: Please say what parts of the PEP you consider to be set in > stone. This will allow discussion to focus o

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Jonathan Fine
Python fits well in the mind, because (1) by design it reduces cognitive load, and (2) it encourages its users to reduce cognitive load, and (3) we have a culture of reading code, taking pride in our code. Readability counts. https://en.wikipedia.org/wiki/Cognitive_load Steven D'Aprano says that e

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Jonathan Fine
Steven D'Aprano wrote: > (For the record, the PEP isn't set in stone in regards to the choice of > operator. Steven: Please say what parts of the PEP you consider to be set in stone. This will allow discussion to focus on essentials rather than details. -- Jonathan _

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Chris Angelico
On Fri, Mar 22, 2019 at 6:47 PM Jonathan Fine wrote: > > Chris Angelico wrote: > > > The trouble with that is that you can't always use a dict subclass (or > > a non-subclass MutableMapping implementation, etc, etc, etc). There > > are MANY situations in which Python will give you an actual real d

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Chris Angelico
On Fri, Mar 22, 2019 at 1:58 PM David Mertz wrote: > > On Thu, Mar 21, 2019, 10:15 PM Steven D'Aprano wrote: >> > Of course I could learn it and teach it, but it will always feel >> > like a wart in the language. >> >> Would that wartness be lessoned if it were spelled | or << instead? > > Yes, d

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-22 Thread Jonathan Fine
Chris Angelico wrote: > The trouble with that is that you can't always use a dict subclass (or > a non-subclass MutableMapping implementation, etc, etc, etc). There > are MANY situations in which Python will give you an actual real dict, > and it defeats the purpose if you then have to construct a

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-22 Thread Terry Reedy
On 3/22/2019 12:53 AM, Steven D'Aprano wrote: On Thu, Mar 21, 2019 at 09:36:20PM -0400, Terry Reedy wrote: I counted what I believe to be 10 instances of copy-update in the top level of /lib. Do either of you consider this to be enough that any addition would be worthwhile. I think you're re