Okay, the python-dev ruling is in, and raising an exception in the __ixxx__ methods is allowed, and even a good idea in the cases of mutable containers.
However, doing the check on 'other' and raising a TypeError with an appropriate message would still be better for a couple reasons:
- all the non-inplace operations raise TypeError when 'other' is not a correct type
- __iand__ is currently buggy because it does not do the check
If backwards compatibility is a concern in this case, a custom "TypeError" that was a subclass of both TypeError and AttributeError could address that. |