On Thu, May 12, 2016 at 11:31 AM, Sven R. Kunze <srku...@mail.de> wrote: > On 11.05.2016 18:43, Brett Cannon wrote: >> >> Rationale >> ========= >> >> Historically in Python, file system paths have been represented as >> strings or bytes. This choice of representation has stemmed from C's >> own decision to represent file system paths as >> ``const char *`` [#libc-open]_. While that is a totally serviceable >> format to use for file system paths, it's not necessarily optimal. At >> issue is the fact that while all file system paths can be represented >> as strings or bytes, not all strings or bytes represent a file system >> path. > > > I can remember this argument being made during the discussion. I am not sure > if that 100% correct as soon as we talk about PurePaths. >
I had suggested an alternative wording for this (see my commit on the work on Rationale). >> Proposal >> ======== >> >> This proposal is split into two parts. One part is the proposal of a >> protocol for objects to declare and provide support for exposing a >> file system path representation. > > > https://docs.python.org/3/whatsnew/changelog.html says: > > "Add ‘path’ attribute to pathlib.Path objects, returning the same as str(), > to make it more similar to DirEntry. Library code can now write getattr(p, > ‘path’, p) to get the path as a string from a Path, a DirEntry, or a plain > string. This is essentially a small one-off protocol." > > So, in order to promote the "small one-off protocol" to a more broader > protocol, this PEP proposes a simple rename of .path to .__fspath__, is that > correct? > Well, I have brought this up previously several times. Indeed I see this as a further development of that duck-typing compatiblity approach. However, while the .path attribute is prior art, it has not been in a release yet. > Unfortunately, I don't have anything to contribute to the open issues. All > solutions have their pros and cons and everything that could be said has > been said. I think you need to decide. > Surprising enough, there are new things being said all the time. But luckily there seem to be signs of convergence. -- Koos _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com