On 8/20/2014 9:01 AM, Antoine Pitrou wrote: > Le 20/08/2014 07:08, Nick Coghlan a écrit : >> >> It's not just the JVM that says text and binary APIs should be separate >> - it's every widely used operating system services layer except POSIX. >> The POSIX way works well *if* everyone reliably encodes things as UTF-8 >> or always uses encoding detection, but its failure mode is unfortunately >> silent data corruption. >> >> That said, there's a lot of Python software that is POSIX specific, >> where bytes paths would be the least of the barriers to porting to >> Windows or Jython. I'm personally +1 on consistently allowing binary >> paths in lower level APIs, but disallowing them in higher level >> explicitly cross platform abstractions like pathlib. > > I fully agree with Nick's position here. > > To elaborate specifically about pathlib, it doesn't handle bytes paths > but allows you to generate them if desired: > https://docs.python.org/3/library/pathlib.html#operators > > Adding full bytes support to pathlib would have added a lot of > complication and fragility in the implementation *and* in the API (is it > allowed to combine str and bytes paths? should they have separate > classes?), for arguably little benefit. I am glad you did not recreate the madness of pre 3.0 Python in that regard. > I think if you want low-level features (such as unconverted bytes paths > under POSIX), it is reasonable to point you to low-level APIs. Do our docs somewhere explain the idea that files names are conceptually *names*, not arbitrary bytes; explain the concept of low-level versus high-level API' and point to the two types of APIs in Python? -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4