Newbie question about text encoding

random832 at fastmail.us random832 at fastmail.us
Mon Mar 9 00:27:56 EDT 2015


On Sun, Mar 8, 2015, at 22:09, Ben Finney wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
> 
> > '\udd00' should be a SyntaxError.
> 
> I find your argument convincing, that attempting to construct a Unicode
> string of a lone surrogate should be an error.
> 
> Shouldn't the error type be a ValueError, though? The statement is not,
> to my mind, erroneous syntax.

In this hypothetical, it's a problem with evaluating a literal - in the
same way that '\U12345', or '\U00110000, is.



More information about the Python-list mailing list