Message128679
> Here is my updated patch:
You don’t have to attach a file here, just update the codereview page instead. Or maybe you can’t because I created the page?
> 1, Now the dbm view objects are the same as dict view objects, which
> are in conformity with collections.KeysView, ValuesView and ItemsView.
Great! Just to make sure: How do you know that the view objects are compliant? Do you test all the methods documented for the ABCs?
> 2, I register all these abcs explicitly because these abcs have not
> __subclasshook__() method so they can't check api conformance(at
> lease exist) through isinstance(). I could not make sure api
> conformance except testing each method I find in abc explicitly. And
> my test_abc() is just to test the registering.
Thank you for repeating that many times and politely: I was indeed wrong. I went back to PEP 3119 to read again about __instancecheck__ and __subclasscheck__, then experimented in a shell and was surprised. I have been misunderstanding one thing: issubclass(cls, abc) does not return true automatically if cls provides the methods, it’s entirely up to the ABC to check methods or do something else in its __subclasscheck__ or __instancecheck__ methods. (I should have known better, I was in a discussion about adding that very feature on python-ideas and #9731!) After another bit of experimentation with dict views and collections ABCs, I finally understand that you have to register your view classes. Thanks for letting me correct my misunderstanding. |
|
Date |
User |
Action |
Args |
2011-02-16 16:35:03 | eric.araujo | set | recipients:
+ eric.araujo, georg.brandl, rhettinger, terry.reedy, stutzbach, r.david.murray, Kain94, ysj.ray |
2011-02-16 16:35:03 | eric.araujo | set | messageid: <1297874103.83.0.593890703113.issue9523@psf.upfronthosting.co.za> |
2011-02-16 16:35:01 | eric.araujo | link | issue9523 messages |
2011-02-16 16:35:01 | eric.araujo | create | |
|