Antoine Pitrou added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22766>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to