> Even if I hate the MBCS encoding, because it replaces undecodable characters > by similar glyphs by default, I'm not certain that it is a good idea to drop > the bytes API. Can it be a problem to port programs from Python2 to Python3? > Do major Python2 programs/libraries rely on the bytes API?
I don't actually know for a fact, but I expect that the answer is "no". The questions is: where do file names typically come from? My guess is that they come from a) hard-coded strings in the source code b) command line arguments/environment variables c) directory listings [of course, there are other ways, like GUI input, getcwd(), etc] In case a), you have filenames such as ".", e.g. as a parameter to listdir or walk. These will typically be regular strings in Python 2, which become Unicode strings in 3. You would actively need to put b"" prefixes into the code. In case b), they will be Unicode strings in Python 3. In case c), they will be Unicode strings if the argument is a Unicode string. So by induction, file names will be typically unicode. The exception will be libraries/applications which make deliberate attempts to get byte-oriented file names. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com