[Patches] [Patch #100699] Augmented Assignment, the Python Way (huge)

noreply@sourceforge.net noreply@sourceforge.net
Sun, 6 Aug 2000 05:33:18 -0700


Patch #100699 has been updated. 

Project: 
Category: core (C code)
Status: Open
Summary: Augmented Assignment, the Python Way (huge)

Follow-Ups:

Date: 2000-Jun-30 17:49
By: twouters

Comment:
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)

-------------------------------------------------------

Date: 2000-Jun-30 18:10
By: gvanrossum

Comment:
Cool! We'll look at this after 2.0 is released...
-------------------------------------------------------

Date: 2000-Jul-13 13:53
By: jhylton

Comment:
This patch needs to be postponed until the PEP is written.

-------------------------------------------------------

Date: 2000-Jul-25 06:37
By: gvanrossum

Comment:
Not ready to be checked in, but Thomas is working on it!
This will be in 2.0 after all...
-------------------------------------------------------

Date: 2000-Aug-06 05:33
By: twouters

Comment:
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.

-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=100699&group_id=5470