Message 230402 - Python tracker (original) (raw)

I think I've changed my mind on this. The important distinction is not between "ducktyping" or "cooperating". It's that this is an in-place mutating operation. A mutating operation should always be the responsibility of the receiver, and so it sounds wrong to be able to delegate it to the read-only operand.

For example, when calling list.extend(op), the list object doesn't allow op to take over the operation's semantics. So I think TypeError is the right outcome here.