By the way, did anyone else notice the irony that's Steve's examples of invalid code is actually perfectly valid? Copying and pasting into the interpreter shows that they are valid strings.
On Sun, May 10, 2020 at 07:09:15AM +0000, Steve Barnes wrote:
But the following all result in an error - "SyntaxError: invalid character in identifier":
S1 = "Double Quoted" # Opened with \u201c and closed with \u201d S2 = 'Single Quoted' # Opened with \u2018 and closed with \u2019
When I first read this, I thought it was because the display font used by mail client doesn't distinguish the fancy Unicode quote marks from the ASCII quotes. But it does:
Double: " vs “ ” Single: ' vs ‘ ’
(Obviously you can't see the glyphs as they are displayed in my editor, but trust me, they are visually distinct :-)
But testing in the interpreter proves that they are regular ASCII quotes, not just look-alikes.
So I thought that Steve made the opposite mistake, accidentally using regular ASCII quotes when he intended to use Unicode quotes. But it turns out that Steve's mail client sends emails with a HTML part and a plain text part, and the plain text part substitutes the ASCII quotes for smart quotes. Very clever!
My mail client prefers the plain text part when it is available, which is usually exactly what I would want. But in this case, it confused me for a bit.