Newbie question about text encoding

Ben Finney ben+python at benfinney.id.au
Sun Mar 8 22:09:26 EDT 2015


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.

-- 
 \     “Please do not feed the animals. If you have any suitable food, |
  `\                     give it to the guard on duty.” —zoo, Budapest |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list