Filipe Laíns <la...@riseup.net> added the comment:

That's why I said it should be optional. If the object can implement it, it 
should. `pathlib.Path` certainly can, `zipfile.Path` can't, and that's alright.
If the Traversable does not represent a path on the file-system, it does not 
make sense to implement `__fspath__`, so it shouldn't.

I think `as_file` should learn to behave like `path`, if `__fspath__` is 
available, it will use that path, otherwise it will do what it does currently, 
which is creating a temporary path and writing the resource contents there.

----------

_______________________________________
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