On 10/08/12 11:25:36, Giacomo Alzetta wrote: > Il giorno venerdì 10 agosto 2012 11:22:13 UTC+2, Hans Mulder ha scritto: [...] > Yes, you're right. I didn't thought the combined operator would do a Py_DECREF > if the iadd operation was implemented, but it obviosuly makes sense.
The += operator cannot know if the iadd returns self or a newly created object. Mutable types usually do the former; non-mutable types must do the latter. Come to think of it: why are your polynomials mutable? As a mathematician, I would think of polynomials as elements of some kind of ring, and I'd expect them to be non-mutable. -- HansM -- http://mail.python.org/mailman/listinfo/python-list