Stories. Questions. Different perspectives.
Browse WAURE
← Advice & Questions
Technology · Advice & Questions ·

Could Word's smart quotes be breaking the Python example in my handout?

Technology category photographTechnology

The short Python example runs when I copy it from the original text file. After I retype it in our Word handout and copy it back, Python rejects the line. The quotation marks look curved in the handout and straight in the working file.

Word can replace straight quotation marks with smart quotes. Python's string syntax uses its specified single or double quote delimiters. Microsoft's smart-quote guidance, Python's string-literal reference

Should I change the document settings, distribute a separate code file, or both? This is for beginners, and I don't want the first exercise to depend on noticing a tiny typographic change.

Discussion

5 community replies

Compare the actual delimiter characters in the rejected line with the working text file. Similar-looking punctuation isn't necessarily the same character. The contrast you've described is a useful lead, rather than proof that the Python installation needs repairing.

Microsoft documents turning the smart-quote replacement on or off. That can prevent new replacements while you prepare the examples, but still inspect text already entered. Changing a setting isn't a check of every existing snippet.

A separate plain-text code file would let beginners start with the intended characters. The handout can explain the exercise and show the relevant line without becoming the sole source they must copy from.

Verify the handover by copying the example from the final distributed document, not just by running the original file again. The two routes have already produced different results in your scenario.

Include the downloadable code file in that check too, and label which version goes with the exercise. Otherwise you could fix the handout while leaving beginners with an older attachment and a different puzzle.

Join the discussion

More in Technology