2

Please note this question, particularly revision one.

In the source, it appears that both strings contain four spaces in a row, but in the rendered output, when not formatted as code (as in revision 1), the gap in the strings is clearly different. Indeed, when I paste the definitions of a and b from the source into a Python interpreter, they show up as being equal (a == b returns True), but when I paste the rendered output into Python, they are unequal (one has four spaces, the other just one). When the lines are indented, so they are rendered as code, they are rendered as equal.

After the first revision, the question was edited many times, including changes to the whitespace characters in the strings, triggering many "can not reproduce" comments, so please check revision one of the question.

Here's a screenshot of when editing revision one:

enter image description here

Could it be that those strings contain some strange whitespaces or control characters (backspace maybe?) and thus are not rendered properly?

1 Answer 1

5

The first code example uses no break spaces (  ==  ), the other uses normal spaces that do get collapsed.

no break spaces to the rescue!

2
  • Sounds plausible. Indeed, when I look at the source for revision one and then at the page source, I can see the  s. But how comes they are turned into normal strings (chr(32)) when I copy them into Python, but remained non-breaking when OP copied them into his code and the question?
    – tobias_k
    Commented Jan 14, 2015 at 10:23
  • @tobias_k - no idea. Could be something the IDE does (OP might be using a different one, or with different settings), or OS related. Could be the OP pasted from a different source. Not really possible to say.
    – Oded StaffMod
    Commented Jan 14, 2015 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .