Message253253
| Author |
r.david.murray |
| Recipients |
merchise, ncoghlan, r.david.murray, rhettinger |
| Date |
2015年10月20日.21:10:16 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1445375416.4.0.0409967073439.issue25448@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
What are you trying to accomplish that needs an abstract base class?
APIError is not an Exception class, it is a meta-class, and thus it does not match the exception because it is not a *base* class of DriverError (it is DiverError's *meta* class).
Now, it is an interesting question whether we want the try/except statement's behavior to match issubclass, since intuitively we think the except in try except is doing the equivalent of issubclass (it isn't).
I don't know why this works in python2, but the class/meta-class machinery did undergo some significant changes. So, it is possible that this is in fact a bug (ie: an unintentional change in semantics). If so, it is also a doc bug, since the try statement docs clear say the expression must evaluate to a base class, and the virtual class (abc) docs *only* mention issubclass and isinstance. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年10月20日 21:10:16 | r.david.murray | set | recipients:
+ r.david.murray, rhettinger, ncoghlan, merchise |
| 2015年10月20日 21:10:16 | r.david.murray | set | messageid: <1445375416.4.0.0409967073439.issue25448@psf.upfronthosting.co.za> |
| 2015年10月20日 21:10:16 | r.david.murray | link | issue25448 messages |
| 2015年10月20日 21:10:16 | r.david.murray | create |
|