[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

"Martin v. Löwis" martin at v.loewis.de
Wed Apr 22 21:17:56 CEST 2009

> -1.  On UNIX, character data is not sufficient to represent paths.  We
> must, must, must continue to have a simple bytes interface to these
> APIs.

I'd like to respond to this concern in three ways:

1. The PEP doesn't remove any of the existing interfaces. So if the
   interfaces for byte-oriented file names in 3.0 work fine for you,
   feel free to continue to use them.

2. Even if they were taken away (which the PEP does not propose to do),
   it would be easy to emulate them for applications that want them.
   For example, listdir could be wrapped as

   def listdir_b(bytestring):
       fse = sys.getfilesystemencoding()
       string = bytestring.decode(fse, "python-escape")
       for fn in os.listdir(string):
           yield fn.encoded(fse, "python-escape")

3. I still disagree that we must, must, must continue to provide these
   interfaces. I don't understand from the rest of your message what
   would *actually* break if people would use the proposed interfaces.


More information about the Python-Dev mailing list