Python: triple quotes

Self-tutoring about programming: the tutor mentions triple quotes in Python.

Technically, there’s no way (that I know of) to produce multiline comments in Python. Rather, the suggestion is that each line is preceded with #.

Yet, in Python, triple quotes can be used to wrap long strings. In my experience, setting a long string, but not using it, can be used to store information in the program. While not technically a comment, it perhaps achieves the same effect.

People have various opinions about this, and it’s probably unsafe to put special characters and such in the triple quotes. However, for just word characters that might be used to remind oneself of an idea, it seems a practical hack for experimental code.



I need to remember this!



Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply