[Python-ideas] Re: Assign-in-place operator

2019-06-11 Thread Caleb Donovick
The problem as I see it with slice assignment is that if we want to operator to mean type defined assignment not necessary in place assignment. It creates confusion for types which have __setitem__. Caleb Donovick On Thu, Jun 6, 2019 at 4:59 PM Greg Ewing wrote: > Stephen J. Turnbull wrote:

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Greg Ewing
Stephen J. Turnbull wrote: L[m:m+k] specifies that a list operation will take place on the k elements starting with m. As a value, it makes a new list of references to those elements. Even that is specific to lists. There's no requirement that a RHS slice has to create new references to elemen

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Stephen J. Turnbull
Yanghao Hua writes: > For example, L[:] if appeared at the right hand side, means a copy > (not a reference) of L, but now when appear on the left hand side, it > behaves like an in-place copy. This two isn't it mentally > contradicting each other? No. I suspect you're confused by the specif

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Yanghao Hua
On Thu, Jun 6, 2019 at 11:10 AM Angus Hollands wrote: > > I'm not sure if you saw my reply earlier: > https://mail.python.org/archives/list/python-ideas@python.org/thread/B7QPHTQSBVN4NFO3SEVR57AIGYPM3MUM/ > > I proposed some alternative syntax already supported. Yes, saw it ... not sure signal[.

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Angus Hollands
I'm not sure if you saw my reply earlier: https://mail.python.org/archives/list/python-ideas@python.org/thread/B7QPHTQSBVN4NFO3SEVR57AIGYPM3MUM/ I proposed some alternative syntax already supported. Python-Ideas mailing list -- python-dev(a)python.org To unsubscribe send an email to python-ideas-

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Yanghao Hua
On Thu, Jun 6, 2019 at 9:48 AM Chris Angelico wrote: > They have a difference for the built-in list type in that slicing a > list returns a new list with references to the same objects, thus "x = > x[:]" is going to give you an equivalent but distinct list. That's an > important point in some cont

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Chris Angelico
On Thu, Jun 6, 2019 at 5:40 PM Yanghao Hua wrote: > > On Thu, Jun 6, 2019 at 6:31 AM Ryan Gonzalez wrote: > > > > Think of it more like indexing a range. Say you have: > > > > L[:] = M[:] > > > > Which is the same as: > > > > L[0:len(L)] = M[0:len(M)] > > > > Which mentally you can think of like:

[Python-ideas] Re: Assign-in-place operator

2019-06-06 Thread Yanghao Hua
On Thu, Jun 6, 2019 at 6:31 AM Ryan Gonzalez wrote: > > Think of it more like indexing a range. Say you have: > > L[:] = M[:] > > Which is the same as: > > L[0:len(L)] = M[0:len(M)] > > Which mentally you can think of like: > > L[0], L[1],...L[len(L)] = M[0],M[1],...M[len(M)] > > Slicing is just i

[Python-ideas] Re: Assign-in-place operator

2019-06-05 Thread Ryan Gonzalez
Think of it more like indexing a range. Say you have: L[:] = M[:] Which is the same as: L[0:len(L)] = M[0:len(M)] Which mentally you can think of like: L[0], L[1],...L[len(L)] = M[0],M[1],...M[len(M)] Slicing is just indexing that represents more than one element, and if you think about it l

[Python-ideas] Re: Assign-in-place operator

2019-06-05 Thread Yanghao Hua
On Tue, Jun 4, 2019 at 12:47 PM Jeroen Demeyer wrote: > > I'd like to get rid of all the signal and HDL stuff (whatever that > means) in this thread, so I think what the original poster really wants > is an "assign in place" operator. Basically, something like += or *= but > without the arithmetic