On Tuesday, June 23, 2015 at 8:34:38 AM UTC+2, Nils Bruin wrote: > > Also, if A is immutable, then an explicit mutating operation would be > uncalled for. If A is mutable then we can just implement __iadd__ without > concern for reference counts. >
I agree, only explicitly mutable objects are safe for in-place operations. In particular, because they cannot be cached. Jeroen's question is how much code should be in the coercion framework for that. I can only think of vectors and matrices as examples of mutable objects where addition is a very common operation. In that case it would probably be better to simplify the coercions and just make add_inplace() a method on matrices. We should't just implement __iadd__ on matrices without backing by the coercion system, though. += and + shouldn't behave differently when it comes to coercion. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.