Jason R. Coombs <jar...@jaraco.com> added the comment:

> I think `as_file` should learn to behave like `path`, if `__fspath__` is 
> available, it will use that path.

Oh, that's an interesting idea. And that's effectively what happens 
[here](https://github.com/python/importlib_resources/blob/1886e2b9d699c55afc1b75dc19e7026ad27e453a/importlib_resources/_common.py#L109),
 where `as_file` returns a native Path object if that's what it encounters. 
Maybe another dispatcher could accept `os.PathLike` and in that case, return 
`pathlib.Path(os.fspath(path))`.

Only thing is, that code would serve no purpose until there existed at least 
one other resource provider besides FileReader that has file-system-local 
resources. I'm not aware of any such provider.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44200>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to