copy on write

Evan Driscoll edriscoll at
Thu Feb 2 22:20:48 CET 2012

On 01/-10/-28163 01:59 PM, 88888 Dihedral wrote:
>> If you're working in C++ and overload your operators so that 'a +='
>> and 'a = + b' have different observable behaviors (besides perhaps
>> time), then either your implementation is buggy or your design is very
>> bad-mannered.
>> Evan
> Do you mean the result instances after 'a+= and 'a=a+b' or
> the actions of behaviors of instances involved  in performing 'a+= and 'a=a+b'?

I mean "if which operation you called is distinguishable in any way 
besides the time it takes to run or by tracing it through in a debugger"

That means:

1. The value of 'a' should be the same after executing 'a+=b' and
2. The actual result of the expression should be the same in both cases
    (in both cases it should be a reference to a)
3. Any additional side effects performed (ew!) should be the same in
    both cases


More information about the Python-list mailing list