[Python-Dev] Bytes path support (original) (raw)
Stephen J. Turnbull stephen at xemacs.org
Fri Aug 22 07:11:08 CEST 2014
- Previous message: [Python-Dev] Bytes path support
- Next message: [Python-Dev] Bytes path support
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Chris Barker - NOAA Federal writes:
This brings up the other key problem. If file names are (almost) arbitrary bytes, how do you write one to/read one from a text file with a particular encoding? ( or for that matter display it on a terminal)
"Very carefully."
But this is strictly from need. Nobody (with the exception of the crackers who like to name their programs things like "\u0007") wants to do this. Real people want to name their files in some human language they understand, and spell it in the usual way, and encode those characters as bytes in the usual way.
Decoding those characters in the usual way and getting nonsense is the exceptional case, and it must be the application's or user's problem to decide what to do. They know where they got the file from and usually have some idea of what its name should look like. Python doesn't, so Python cannot solve it for them.
For that reason, I believe that Python's "normal"/high-level approach to file handling should treat file names as (human-oriented) text. Of course Python should be able to handle bytes straight from the disk, but most programmers shouldn't have to.
And people still want to say posix isn't broken in this regard?
Deal with it, bro'.
- Previous message: [Python-Dev] Bytes path support
- Next message: [Python-Dev] Bytes path support
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]