Title: New Assignment operator
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.9
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Arthur Fibich, opensource-assist, xtreak
Priority: normal Keywords:

Created on 2020-01-24 23:13 by Arthur Fibich, last changed 2020-01-25 16:07 by SilentGhost. This issue is now closed.

Messages (3)
msg360659 - (view) Author: Arthur Fibich (Arthur Fibich) Date: 2020-01-24 23:13
It's just a personal thing, but I kind of miss the following possibility in Python (and likewise every other language I know):
a += 1 
is the same as
a = a + 1

I'd love to see
a .= b()
as an opportunity to express
a = a.b()

Possible usages are for example linked lists or other structures, where a class's attributes or methods are/return an object of the same type.
msg360668 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-01-25 02:47
This is a syntax change and it should be discussed in python-ideas mailing list first and would require a PEP. I would suggest closing it now and reopening it if the idea is accepted.
msg360694 - (view) Author: Aurora (opensource-assist) * Date: 2020-01-25 15:52
That's a nice simple idea.
Date User Action Args
2020-01-25 16:07:22SilentGhostsetstatus: open -> closed
resolution: rejected
stage: resolved
2020-01-25 15:52:24opensource-assistsetnosy: + opensource-assist
messages: + msg360694
2020-01-25 02:47:54xtreaksetnosy: + xtreak
messages: + msg360668
2020-01-24 23:13:50Arthur Fibichcreate