[Python-Dev] Augmented assignment

Thomas Wouters thomas@xs4all.net
Thu, 24 Aug 2000 23:09:49 +0200


On Thu, Aug 24, 2000 at 04:45:53PM -0500, Guido van Rossum wrote:

> Nits: Lib/symbol.py and Lib/token.py need to be regenerated and
> checked in; (see the comments at the top of the file).

Checking them in now.

> Also, tokenizer.py probably needs to have the new tokens += etc. added
> manually.

Okay. I'm not entirely sure how to do this, but I *think* this does it:
replace

Operator = group('\+', '\-', '\*\*', '\*', '\^', '~', '/', '%', '&', '\|',
                 '<<', '>>', '==', '<=', '<>', '!=', '>=', '=', '<', '>')

with

Operator = group('\+=', '\-=', '\*=', '%=', '/=', '\*\*=', '&=', '\|=',
                 '\^=', '>>=', '<<=', '\+', '\-', '\*\*', '\*', '\^', '~',
                 '/', '%', '&', '\|', '<<', '>>', '==', '<=', '<>', '!=',
                 '>=', '=', '<', '>')

Placing the augmented-assignment operators at the end doesn't work, but this
seems to do the trick. However, I can't really test this module, just check
its output. It seems okay, but I would appreciate either an 'okay' or a
more extensive test before checking it in. No, I can't start IDLE right now,
I'm working over a 33k6 leased line and my home machine doesn't have an
augmented Python yet :-)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!