<br><br><div class="gmail_quote">On Wed Aug 20 2014 at 9:02:25 AM Antoine Pitrou <<a href="mailto:antoine@python.org">antoine@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le 20/08/2014 07:08, Nick Coghlan a écrit :<br>
><br>
> It's not just the JVM that says text and binary APIs should be separate<br>
> - it's every widely used operating system services layer except POSIX.<br>
> The POSIX way works well *if* everyone reliably encodes things as UTF-8<br>
> or always uses encoding detection, but its failure mode is unfortunately<br>
> silent data corruption.<br>
><br>
> That said, there's a lot of Python software that is POSIX specific,<br>
> where bytes paths would be the least of the barriers to porting to<br>
> Windows or Jython. I'm personally +1 on consistently allowing binary<br>
> paths in lower level APIs, but disallowing them in higher level<br>
> explicitly cross platform abstractions like pathlib.<br>
<br>
I fully agree with Nick's position here.<br>
<br>
To elaborate specifically about pathlib, it doesn't handle bytes paths<br>
but allows you to generate them if desired:<br>
<a href="https://docs.python.org/3/library/pathlib.html#operators" target="_blank">https://docs.python.org/3/<u></u>library/pathlib.html#operators</a><br>
<br>
Adding full bytes support to pathlib would have added a lot of<br>
complication and fragility in the implementation *and* in the API (is it<br>
allowed to combine str and bytes paths? should they have separate<br>
classes?), for arguably little benefit.<br>
<br>
I think if you want low-level features (such as unconverted bytes paths<br>
under POSIX), it is reasonable to point you to low-level APIs.<br></blockquote><div><br></div><div>+1 from me as well. Allowing the low-level stuff work on bytes but keeping high-level actually high-level keeps with our consenting adults policy as well as making things possible, but not at the detriment of the common case. <br>
</div></div>