Brett Cannon added the comment:

The classes mentioned actually require that the path exist on the file system 
so there's no extra restrictions. As for cost, it's pretty cheap as a call to 
_os.fspath() is written in C and does an immediate type-check for str or bytes 
for the common-case 
(https://github.com/python/cpython/blob/master/Modules/posixmodule.c#L12099). 
These classes are also instantiated once typically and then cached so the cost 
is only paid once per object.

As for use-cases, I've seen people directly instantiate these classes in user 
code and so supporting paths in a universal way like the rest of the stdlib 
would be good for consistency.

----------

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

Reply via email to