[Python-Dev] Emit a BytesWarning on bytes filenames on Windows
Victor Stinner
victor.stinner at haypocalc.com
Sun Oct 30 22:26:20 CET 2011
Le 30/10/2011 09:00, "Martin v. Löwis" a écrit :
>> As quoted above, deprecation of the bytes version of the API sounds
>> fine to me, but isn't this going to run into the usual objections from
>> the "we need bytes for efficiency" crowd? It's OK with me<wink> to
>> say "in this restricted area you must convert to Unicode", but is that
>> going to fly with that constituency?
>
> I don't think this "we need bytes for efficiency" crowd actually exists.
> We are talking about file names here. The relevant crowd is the
> "we need bytes for correctness", and that crowd focuses primarily on
> Unix.
Oh, by the way, it is important to know that Unicode filenames is the
best way to write portable programs with Python 3. On UNIX, since Python
3.1, undecodables filename don't raise Unicode errors: undecodable bytes
are stored as surrogates (see the PEP 383). So even if the computer is
completly misconfigured, it "just works".
On Windows, you must Unicode for filenames for correctness.
Anyway, with Python 3, it's easier to manipulate Unicode strings than
bytes strings.
Martin finally agreed with me, I should hurry to implement my idea! :-)
Victor
More information about the Python-Dev
mailing list