Message167219
On Aug 02, 2012, at 11:33 AM, Nick Coghlan wrote:
>Specifically, what I did was to drop "find_module" from the Finder ABC, but
>keep the ABC itself as a way to document the common "invalidate_caches"
>API. The ABC definition no longer cares whether you implement find_module()
>or not. MetaPathFinder then enforces find_module(), while PathEntryFinder
>enforces find_loader().
One problem I have, which I'm not sure how to solve, is that the protocol
defines a couple of optional methods, specifically find_loader() on meta path
finders, and module_repr() on loaders.
You'd like for the ABC to be able to capture both the support of these methods
if they exist, and their optional nature, but I don't believe that's possible
with @abc.abstractmethod. Correct me if I'm wrong, but by adding these
methods to the ABC, it requires subclasses to define them. I noticed this
when I broke the test suite, and solved it by just adding the methods to the
mocks and other test classes. But I think this is not the best solution.
Maybe we need an @abc.optionalabstractmethod decorator? ;) |
|
Date |
User |
Action |
Args |
2012-08-02 13:54:53 | barry | set | recipients:
+ barry, brett.cannon, georg.brandl, ncoghlan, eric.smith, Arfrever, python-dev, eric.snow |
2012-08-02 13:54:52 | barry | link | issue15502 messages |
2012-08-02 13:54:51 | barry | create | |
|