Re: [Python-ideas] PEP 8 update on line length

2019-02-27 Thread Rhodri James
On 26/02/2019 02:01, Christopher Barker wrote: We could reword: """ Some teams strongly prefer a longer line length. For code maintained exclusively or primarily by a team that can reach agreement on this issue, it is okay to increase the nominal line length from 80 to 100 characters

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

2019-02-27 Thread João Matos
Hello, I would like to propose that instead of using this (applies to Py3.5 and upwards) dict_a = {**dict_a, **dict_b} we could use dict_a = dict_a + dict_b or even better dict_a += dict_b Best regards, João Matos

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

2019-02-27 Thread João Matos
Hello, Great. Because I don't program in any other language except Python, I can't make the PR (with the C code). Maybe someone who program in C can help? Best regards, João Matos On 27-02-2019 18:48, Guido van Rossum wrote:

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

2019-02-27 Thread George Castillo
> > The key conundrum that needs to be solved is what to do for `d1 + d2` when > there are overlapping keys. I propose to make d2 win in this case, which is > what happens in `d1.update(d2)` anyways. If you want it the other way, > simply write `d2 + d1`. This would mean that addition, at least

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

2019-02-27 Thread MRAB
On 2019-02-27 17:37, Guido van Rossum wrote: On Wed, Feb 27, 2019 at 9:34 AM George Castillo > wrote: The key conundrum that needs to be solved is what to do for `d1 + d2` when there are overlapping keys. I propose to make d2 win in this case,

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

2019-02-27 Thread Anders Hovmöller
I dislike the asymmetry with sets: > {1} | {2} {1, 2} To me it makes sense that if + works for dict then it should for set too. / Anders > On 27 Feb 2019, at 17:25, João Matos wrote: > > Hello, > > I would like to propose that instead of using this (applies to Py3.5 and > upwards) >

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

2019-02-27 Thread Guido van Rossum
On Wed, Feb 27, 2019 at 8:50 AM Rhodri James wrote: > On 27/02/2019 16:25, João Matos wrote: > > I would like to propose that instead of using this (applies to Py3.5 and > upwards) > > dict_a = {**dict_a, **dict_b} > > > > we could use > > dict_a = dict_a + dict_b > > > > or even better > >

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

2019-02-27 Thread Guido van Rossum
On Wed, Feb 27, 2019 at 9:34 AM George Castillo wrote: > The key conundrum that needs to be solved is what to do for `d1 + d2` when >> there are overlapping keys. I propose to make d2 win in this case, which is >> what happens in `d1.update(d2)` anyways. If you want it the other way, >> simply

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

2019-02-27 Thread Oleg Broytman
On Wed, Feb 27, 2019 at 09:05:20AM -0800, Guido van Rossum wrote: > On Wed, Feb 27, 2019 at 8:50 AM Rhodri James wrote: > > > On 27/02/2019 16:25, Jo??o Matos wrote: > > > I would like to propose that instead of using this (applies to Py3.5 and > > upwards) > > > dict_a = {**dict_a, **dict_b}

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

2019-02-27 Thread Michael Selik
On Wed, Feb 27, 2019 at 10:22 AM Anders Hovmöller wrote: > I dislike the asymmetry with sets: > > > {1} | {2} > {1, 2} > > To me it makes sense that if + works for dict then it should for set too. > > / Anders > > > On 27 Feb 2019, at 17:25, João Matos wrote: > > > > Hello, > > > > I would like

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

2019-02-27 Thread Rhodri James
On 27/02/2019 16:25, João Matos wrote: Hello, I would like to propose that instead of using this (applies to Py3.5 and upwards) dict_a = {**dict_a, **dict_b} we could use dict_a = dict_a + dict_b or even better dict_a += dict_b While I don't object to the idea of concatenating

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

2019-02-27 Thread Guido van Rossum
On Wed, Feb 27, 2019 at 10:42 AM Michael Selik wrote: > > > On Wed, Feb 27, 2019 at 10:22 AM Anders Hovmöller > wrote: > >> I dislike the asymmetry with sets: >> >> > {1} | {2} >> {1, 2} >> >> To me it makes sense that if + works for dict then it should for set too. >> >> / Anders >> >> > On 27

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

2019-02-27 Thread E. Madison Bray
On Wed, Feb 27, 2019 at 6:35 PM George Castillo wrote: >> >> The key conundrum that needs to be solved is what to do for `d1 + d2` when >> there are overlapping keys. I propose to make d2 win in this case, which is >> what happens in `d1.update(d2)` anyways. If you want it the other way, >>

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

2019-02-27 Thread Antoine Pitrou
On Wed, 27 Feb 2019 10:48:21 -0800 Guido van Rossum wrote: > > Great, this sounds like a good argument for + over |. The other argument is > that | for sets *is* symmetrical, [...] As much as it can be: >>> {-0.0} | {0.0} {-0.0} >>> {0.0} | {-0.0} {0.0} ;-) Antoine.

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

2019-02-27 Thread Brandt Bucher
I’d like to try my hand at implementing this, if nobody else is interested. I should be able to have something up today. Brandt > On Feb 27, 2019, at 11:05, João Matos wrote: > > Hello, > > Great. > Because I don't program in any other language except Python, I can't make the > PR (with the

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

2019-02-27 Thread David Mertz
"foo" + "bar" != "bar" + "foo" On Wed, Feb 27, 2019, 12:35 PM George Castillo wrote: > The key conundrum that needs to be solved is what to do for `d1 + d2` when >> there are overlapping keys. I propose to make d2 win in this case, which is >> what happens in `d1.update(d2)` anyways. If you

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

2019-02-27 Thread Steven D'Aprano
On Wed, Feb 27, 2019 at 10:34:43AM -0700, George Castillo wrote: > > > > The key conundrum that needs to be solved is what to do for `d1 + d2` when > > there are overlapping keys. I propose to make d2 win in this case, which is > > what happens in `d1.update(d2)` anyways. If you want it the other

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

2019-02-27 Thread Guido van Rossum
OK, you're it. Please write a PEP for this. On Wed, Feb 27, 2019 at 3:53 PM Steven D'Aprano wrote: > On Wed, Feb 27, 2019 at 10:34:43AM -0700, George Castillo wrote: > > > > > > The key conundrum that needs to be solved is what to do for `d1 + d2` > when > > > there are overlapping keys. I

Re: [Python-ideas] PEP 8 update on line length

2019-02-27 Thread Chris Barker via Python-ideas
On Wed, Feb 27, 2019 at 5:53 AM Rhodri James wrote: > > To be a bit less harsh -- that is, change the clause: > > > > "For code maintained exclusively or primarily by a team that can reach > > agreement on this issue, it is okay ..." > > > > To maybe just > > > > "For code maintained by a team

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

2019-02-27 Thread Brandt Bucher
Here is a working implementation of dictionary addition, for consideration with the PEP: https://bugs.python.org/issue36144 Brandt > On Feb 27, 2019, at 16:07, Guido van Rossum wrote: > > OK, you're it. Please write a PEP for this. > >> On Wed, Feb 27, 2019 at 3:53 PM Steven D'Aprano

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

2019-02-27 Thread Serhiy Storchaka
27.02.19 20:48, Guido van Rossum пише: On Wed, Feb 27, 2019 at 10:42 AM Michael Selik > wrote > The dict subclass collections.Counter overrides the update method for adding values instead of overwriting values.