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: Augmented Assignment, the Python Way (huge)
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: twouters Nosy List: gvanrossum, jhylton, twouters
Priority: normal Keywords: patch

Created on 2000-07-01 00:42 by twouters, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None twouters, 2000-07-01 00:42 None
Messages (10)
msg32981 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2000-07-01 00:42
 
msg32982 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-07-01 01:10
Cool! We'll look at this after 2.0 is released...
msg32983 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-07-25 13:37
Not ready to be checked in, but Thomas is working on it!
This will be in 2.0 after all...
msg32984 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-08-21 03:42
BDFL pronouncement: please use __iadd__, __imul__ etc.
msg32985 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-08-23 15:42
Accepted.  Please check it in.  Then work on the docs.

Please send us the docs even if you don't get to finish them!!!
msg32986 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2000-07-13 20:53
This patch needs to be postponed until the PEP is written.
msg32987 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2000-07-01 00:49
This patch adds augmented assignment (+=, **=, etc) to Python, in a manner which seems consistent with Guido and Tim's wishes (for as far as I know them.)

Guido has already stated this patch will not make it to Python 2.0, so the first to read this should probably set the state to 'postponed'. I'll try and keep this patch up to date none the less, for peer (or rather parent ;) reviewal.

The patch adds everything in one smack: Syntax, a new type of bytecode (2-argument), 9 new bytecodes, 13 new API calls, 11 new PyNumber_Methods members, 2 new PySequence_Methods members, and support for the new functionality in builtin types and supplied Python classes. Oh, and a test suite.

None the less, it isn't that intrusive a patch, and the simplicity of the implementation still boggles me. For more information, see http://www.xs4all.nl/~thomas/python/
Comments greatly appreciated! Contact me on thomas@xs4all.net (I'm not on python-dev)
msg32988 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2000-08-06 12:33
New version of the patch, that eliminates the need for 2-argument opcodes and the GETSET_* opcodes. Instead, INPLACE_* opcodes are used, that mirror the BINARY_* opcodes, and two new 'utility' opcodes: ROT_FOUR and DUP_TOPX (duplicates the top <x> items on the stack.)

The PEP documenting this implementation will follow soon.
msg32989 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2000-08-22 16:26
Up to date version that incorporates the BDFL-Pronouncement to use __iadd__ rather than __add_ab__. Also made PyNumber_InPlacePower() a three-argument function (since normal Power() is one, and we can't change this functions' prototype later, if we would want to.) The three argument InPlacePower() does the normal batch of coercions, so it's not terribly likely to remain an 'in-place' operation :-S

I'm working on docs, but on my laptop, not incorporated in this patch. Also, the testcase needs to be expanded a bit, and probably incorporated with the test_class testcase I added last week.
msg32990 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2000-08-24 20:12
This patch is being checked in right now. However, the patch as found here is not the same as the one being checked in: Guido suggested a better way to do the PyNumber_InPlace*() API functions, which also removes the biggest remaining issue from the PEP, and the patch going in implements that suggestion.
History
Date User Action Args
2022-04-10 16:02:02adminsetgithub: 32503
2000-07-01 00:42:41twouterscreate