[Python-Dev] Pathlib enhancments - method name only

Koos Zevenhoven k7hoven at gmail.com
Fri Apr 8 16:51:00 EDT 2016


On Fri, Apr 8, 2016 at 11:39 PM, R. David Murray <rdmurray at bitdance.com> wrote:
> On Fri, 08 Apr 2016 19:24:44 -0000, Brett Cannon <brett at python.org> wrote:
>> On Fri, 8 Apr 2016 at 12:10 Chris Angelico <rosuav at gmail.com> wrote:
>>
>> > On Sat, Apr 9, 2016 at 5:03 AM, Chris Barker <chris.barker at noaa.gov>
>> > wrote:
>> > > On Fri, Apr 8, 2016 at 11:34 AM, Koos Zevenhoven <k7hoven at gmail.com>
>> > wrote:
>> > >>
>> > >> >
>> > >> > __pathstr__ # pathstring
>> > >> >
>> > >>
>> > >> Or perhaps __pathstring__ in case it may be or return byte strings.
>
> But there are other paths than OS file system paths.  I prefer
> __fspath__ or __os_path__ myself.  I think the fact that it is a string
> is implied by the fact that it is getting us the thing we can pass
> to the os (since Python3 deals with os paths as strings unless you
> specify otherwise, only converting them back to bytes, on unix, at the last
> moment).
>
> Heh, although I suppose one could make the argument that it should
> return whatever the native OS wants, and save the low level code
> from having to do that?  Pass the path object all the way down
> to that "final step" in the C layer?  (Just ignore me, I'm sure
> I'm only making trouble :)

My favorites are fspath and pathname, and since this is a dunder
methdod, it is not as crucial what it is called. I have the feeling
the consensus is converging towards fspath?

I'll comment on the bytes issue in the other thread. Boy these threads
are all over the place!

-Koos


More information about the Python-Dev mailing list