[Python-Dev] file system path protocol PEP
Sven R. Kunze
srkunze at mail.de
Thu May 12 12:26:14 EDT 2016
On 12.05.2016 17:42, Ethan Furman wrote:
> On 05/12/2016 01:31 AM, Sven R. Kunze wrote:
>
>> I think the "Rationale" section ignores the fact the Path also supports
>> the .path attribute now. Which indeed defines a common interface between
>> path objects.
>
> The version of Python that has Path.path has not been released yet.
> And even so, .path is not a "common interface" as neither str nor
> bytes have it, and they also are used as path objects.
str and bytes will receive the __fspath__ attribute when this PEP is
accepted?
> And even given all that, for smoother interoperability with the rest
> of the stdlib, or at least the os.* portion, those functions would
> still need to be upgraded to check for .path on the incoming arguments
> -- at which point we may as well make a protocol to properly support
> file system paths instead of relying on the rather generic attribute
> name of 'path'.
Just so, if you accept changing os.* as a necessary solution.
If not, keeping .path would suffice and would be much simpler.
Best,
Sven
More information about the Python-Dev
mailing list