Puzzling output from debugger

I just spent some time trying to figure out a bug which I thought the PyCharm debugger was reporting, and found that it doesn't exist. I hope someone can explain how to interpret correctly what the debugger told me.

I've got a string whose value consists of a quotation mark; a letter; a backslash; an apostrophe; and another quotation mark. That is, it looks like this:

" x \ ' "

(In this post I'm adding a space between adjacent letters, since there seems to be no way to format code in a monospace font.)

I could have created it with this assignment (although in fact it was derived from another string):

escaped = ' " x \ \ \ ' " '

But the debugger displays its value like this:

escaped = {str} ' " x \ \ \ \ ' " '

What is happening here?

Please sign in to leave a comment.