This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients Arfrever, barry, brett.cannon, eric.smith, eric.snow, georg.brandl, ncoghlan, python-dev
Date 2012-08-02.13:54:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20120802095448.11cfec74@resist.wooz.org>
In-reply-to <1343907205.36.0.450059955606.issue15502@psf.upfronthosting.co.za>
Content
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? ;)
History
Date User Action Args
2012-08-02 13:54:53barrysetrecipients: + barry, brett.cannon, georg.brandl, ncoghlan, eric.smith, Arfrever, python-dev, eric.snow
2012-08-02 13:54:52barrylinkissue15502 messages
2012-08-02 13:54:51barrycreate