[Python-ideas] Add "namereplace" error handler

Serhiy Storchaka storchaka at gmail.com
Tue Jun 11 13:21:49 CEST 2013


I propose to add "namereplace" error handler which is similar to 
"backslashreplace" error handler but use \N escapes instead of \x/\u/\U 
escapes.

 >>> '−1'.encode('ascii', 'backslashreplace')
b'\\u22121'
 >>> '−1'.encode('ascii', 'namereplace')
b'\\N{MINUS SIGN}1'

In some cases such representation is more readable.

What are you think about this? Are there suggestions for better name?



More information about the Python-ideas mailing list