[Python-Dev] File system path PEP, part 2 (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Fri May 13 00:04:24 EDT 2016
- Previous message (by thread): [Python-Dev] File system path PEP, part 2
- Next message (by thread): [Python-Dev] File system path PEP, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 13 May 2016 at 06:53, Brett Cannon <brett at python.org> wrote:
Second draft that takes Guido's comments into consideration. The biggest change is os.fspath() now returns whatever path.fspath() returns instead of restricting it to only str.
Minor changes: - Renamed the C function to PyOSFSPath() - Added an Implementation section with a TODO list - Bunch of things added to the Rejected Ideas section
+1 for this version from me, as it means we have:
- os.fsencode(obj) as the coerce-to-bytes API
- os.fspath(obj) as the str/bytes hybrid API
- os.fsdecode(obj) as the coerce-to-str API
- os.fspath(pathlib.PurePath(obj)) as the error-on-bytes API
That more strongly nudges people towards "use pathlib if you want to ensure cross-platform friendly path handling", which is an outcome I'm fine with.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] File system path PEP, part 2
- Next message (by thread): [Python-Dev] File system path PEP, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]