copy on write

Terry Reedy tjreedy at udel.edu
Thu Feb 2 12:25:00 EST 2012


On 2/2/2012 9:17 AM, John O'Hagan wrote:

> It's not so much about the type of x but that of x[1]. Wouldn't it be
> possible to omit the assignment simply if the object referred to by
> x[1] uses "+=" without creating a new object? That way, some_tuple[i]
> += y will succeed if some_tuple[i] is a list but not with, say, an
> int. That seems reasonable to me.

There was considerable discussion of the exact semantics of augmented 
operations when they were introduced. I do not remember if that 
particular idea was suggested (and rejected) or not. You could try to 
look at the PEP, if there is one, or the dicussion ( probably on pydev 
list).

-- 
Terry Jan Reedy




More information about the Python-list mailing list