[Python-ideas] Assign-in-place operator
Jeroen Demeyer
J.Demeyer at UGent.be
Tue Jun 4 06:47:30 EDT 2019
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.
When you think of it this way, it's not an unreasonable request. There
would be at least one major use of this operator within CPython, for
lists. With this proposal, the awkward syntax (there are 219 instances
of this in the CPython sources)
L[:] = new_list
would become
L <== new_list
The implementation would be completely analogous to the existing
in-place arithmetic operators. For example A <== B would become
equivalent to A = type(A).__iassign__(A, B).
More information about the Python-ideas
mailing list