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 think if you want low-level features (such as unconverted bytes paths under POSIX), it is reasonable to point you to low-level APIs.

Regards

Antoine.


_______________________________________________
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

Reply via email to