This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add this optionality
Type: enhancement Stage: resolved
Components: Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: mablue, ned.deily, veky
Priority: normal Keywords:

Created on 2021-04-02 03:36 by mablue, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg390032 - (view) Author: Masoud Azizi (mablue) Date: 2021-04-02 03:36
I want to rediuse two var togeder!
When i do that buy sum is rediuse to zero and not effect the sellsum
buySum[pair] -= sellSum[pair]
sellSum[pair] -= buySum[pair]

Cuz of that i try this statment but its not work!
Its a simple code that will python support it:

buySum[pair],sellSum[pair] -= sellSum[pair], buySum[pair]

Please add this optionallity to python
msg390123 - (view) Author: Vedran Čačić (veky) * Date: 2021-04-03 13:02
Well, just reverse the order of -= in second statement. If you write =-, it will magically work. ;-)

But in the general case, sometimes introducing temporary variables is the simplest solution.

The alternative would be to implement pointwise -= for tuples, which would be extremely confusing since they already implement += with a completely different semantics.
msg390129 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-04-03 16:42
If you want to pursue your suggestion for a change in the language, the best place to do so is first on the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). The issue tracker here is more for bugs and minor enhancements.
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87867
2021-04-03 16:42:52ned.deilysetstatus: open -> closed

nosy: + ned.deily
messages: + msg390129

resolution: not a bug
stage: resolved
2021-04-03 13:02:32vekysetnosy: + veky
messages: + msg390123
2021-04-02 03:36:06mabluecreate