Class Variable Access and Assignment

Mike Meyer mwm at
Sat Nov 5 05:49:29 CET 2005

bokr at (Bengt Richter) writes:
> On 04 Nov 2005 17:53:34 -0800, Paul Rubin <> wrote:
>>bokr at (Bengt Richter) writes:
>>> Hm, "the" fix? Why wouldn't e.g. treating augassign as shorthand for
>>> a source transformation (i.e., asstgt <op>= expr becomes by simple
>>> text substitution asstgt = asstgt <op> expr) be as good a fix? Then
>>> we could discuss what
>>Consider "a[f()] += 3".  You don't want to eval f() twice.
> Well, if you accepted macro semantics IWT you _would_ want to ;-)

Another one of those throw-away lines.

I'd say that was true only if the macro was poorly written. Unless a
macros is intended as a tool to repeatedly evaluate an argument, it
should only evaluate it at most once.

Of course, if you're using some rock-stupid textual macro system, you
really don't have much choice in the matter.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list