Message230559
| Author |
ethan.furman |
| Recipients |
Jim.Jewett, Joshua.Chin, ethan.furman, pitrou, r.david.murray, rhettinger |
| Date |
2014年11月03日.20:21:46 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1415046106.85.0.444028052201.issue22766@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|