New submission from Filipe Laíns <la...@riseup.net>:

The files()/Traversable api is meant to replace ResourceReader api, but it 
falls short in one dimension, tying the abstraction to a file system path.

I propose to document that Traversable users *should* implement __fspath__ if 
the Traversable represents a file-system path.

This will essentially make os.fspath(importlib.resources.files(module) / 
resource) the equivalent of importlib.resources.path(module, resource), for 
which currently there is no replacement using files().

----------
messages: 394083
nosy: FFY00, brett.cannon, jaraco
priority: normal
severity: normal
status: open
title: Recommend importlib.abc.Traversable users to implement __fspath__
versions: Python 3.10

_______________________________________
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