Message109944
| Author |
stutzbach |
| Recipients |
eric.araujo, rhettinger, stutzbach |
| Date |
2010年07月10日.23:42:23 |
| SpamBayes Score |
0.0003664281 |
| Marked as misclassified |
No |
| Message-id |
<1278805345.36.0.729772848157.issue9212@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In this case, the concrete class is the one missing a method.
Concrete classes are allowed to provide more features than the corresponding ABC, but the converse is not true to the best of my knowledge.
dict_keys .register()s as supporting the Set ABC, so it does not automatically pick up the method through inheritance. Put another way:
>>> # dict_keys provides the Set ABC API
>>> isinstance({}.keys(), collections.Set)
True
>>> # The Set ABC provides isdisjoint
>>> hasattr(collections.Set, 'isdisjoint')
True
>>> # Ergo, dict_keys should provide isdisjoint ... but it doesn't
>>> hasattr({}.keys(), 'isdisjoint')
False
See also Issue9213 for another case where a concrete class is missing a method provided by an ABC it claims to support.
I sort of wonder if .register() should verify that the concrete class provides all of the methods of the ABC. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年07月10日 23:42:25 | stutzbach | set | recipients:
+ stutzbach, rhettinger, eric.araujo |
| 2010年07月10日 23:42:25 | stutzbach | set | messageid: <1278805345.36.0.729772848157.issue9212@psf.upfronthosting.co.za> |
| 2010年07月10日 23:42:24 | stutzbach | link | issue9212 messages |
| 2010年07月10日 23:42:23 | stutzbach | create |
|