Jason R. Coombs <jar...@jaraco.com> added the comment:
> are people supposed to be implementing readers with just files(), or are they > always expected to inherit TraversableResources? A resource provider could potentially implement only the `files()` method (what I think you're calling `TraversableReader`), but my expectation was that all providers would provide a Reader derived from `TraversableResources` in order to provide backward-compatibility for the `ResourceReader` interface. Long term, I'd expect to deprecate all but `files()` on `TraversableResources`. If a provider only implemented `files()` today and did not inherit from `TraversableResources`, they would still satisfy the `files()` API, but not the ResourceReader API (i.e. violate the expectation that `Loader.get_resource_reader` returns a ResourceReader). I decided not to present both `TraversableReader` and `TraversableResources` as separate classes because the latter was sufficient for all known cases. > It seems to me that maybe that is an issue and we actually want > [DegenerateFiles] to inherit from TraversableResources. Perhaps. What advantage would that have? > Regardless of the usefulness in code, please also consider type hinting. Agreed, there are some places where type hints would drastically improve readability. > If people are expecting to be using this protocol, we should expose it. My instinct is `TraversableResources` is the preferred protocol for now, although I think it's likely we'll want to separate out the TraversableReader when necessary. Let's plan to do that in importlib_resources first. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44195> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com