Class Variable Access and Assignment

Mike Meyer mwm at mired.org
Fri Nov 4 23:49:29 EST 2005


bokr at oz.net (Bengt Richter) writes:
> On 04 Nov 2005 17:53:34 -0800, Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:
>>bokr at oz.net (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
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list