[Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

Ethan Furman ethan at stoneleaf.us
Tue Apr 12 12:37:13 EDT 2016


On 04/12/2016 09:20 AM, Chris Angelico wrote:
> On Wed, Apr 13, 2016 at 2:15 AM, Ethan Furman

>> latin1?  I thought latin1 had a code point for 0-255, so how could using it
>> raise an encoding error?
>
> Latin-1 / ISO-8859-1 defines a character for every byte, so any byte
> string will *decode*. It only defines 256 characters as having
> equivalent bytes, though, so *encoding* can fail.

Ah, right -- so if you start with bytes it cannot fail, if you start 
with a string it can.

--
~Ethan~



More information about the Python-Dev mailing list