[Python-Dev] Defining a path protocol
Ethan Furman
ethan at stoneleaf.us
Thu Apr 7 02:31:27 EDT 2016
On 04/06/2016 11:15 PM, Greg Ewing wrote:
> Chris Barker - NOAA Federal wrote:
>> But fspath(), if it exists, would call __fspath__ on an arbitrary
>> object, and create a new string -- not a new Path. That may be
>> confusing...
>
> Maybe something like fspathstr/__fspathstr__ would be better?
As someone already said, we don't need to embed the type in the name.
The point of the __os_path__ protocol is to return the serialized
version of the Path the object represents. This would be somewhat
similar to the various __reduce*__ protocols (which I thought had
something to do with adding until I learned what they were for).
--
~Ethan~
More information about the Python-Dev
mailing list