[Python-ideas] Adding "+" and "+=" operators to dict

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Feb 14 03:46:20 CET 2015


Andrew Barnert wrote:

> I think it's reasonable for a target to be able to assume that it will get a
> setattr or setitem when one of its subobjects is assigned to. You might need
> to throw out cached computed properties, ...

That's what I was thinking. But I'm not sure it would be
a good design, since it would *only* catch mutations made
through in-place operators. You would need some other
mechanism for detecting mutations of sub-objects made in
other ways, and whatever mechanism you used for that would
probably catch in-place operations as well.

-- 
Greg


More information about the Python-ideas mailing list