[Python-Dev] Use of %c and Py_UNICODE

Fredrik Lundh fredrik@effbot.org
Mon, 18 Dec 2000 11:15:26 +0100


mal wrote:

> > But the error message is being produced because the
> > character is NOT a valid format character. One of the
> > reasons for that might be because it's not in the
> > 7-bit range!
> 
> True. 
> 
> I think removing %c completely in that case is the right
> solution (in case you don't want to convert the Unicode char
> using the default encoding to a string first).

how likely is it that a human programmer will use a bad formatting
character that's not in the ASCII range?

-1 on removing it -- people shouldn't have to learn the octal ASCII
table just to be able to fix trivial typos.

+1 on mapping the character back to a string in the same was as
"repr" -- that is, print ASCII characters as is, map anything else to
an octal escape.

+0 on leaving it as it is, or mapping non-printables to "?".

</F>