[issue31253] Python fails to parse triple quoted (commented out) code

R. David Murray report at bugs.python.org
Tue Aug 22 09:17:19 EDT 2017


R. David Murray added the comment:

Just FYI, Vedran, almost everyone gets this one wrong :)  I too once thought that triple quoted text used as comments was bad style, but in fact I learned they are an accepted way in Python to do multiline comments.  Accepted by Guido, at least: https://sgillies.net/2017/05/30/python-multi-line-comments-and-triple-quoted-strings.html :)  It is not a common practice, though, in my observation, since most code editors support automatically prefixing and unprefixing a block with '#' characters, and highlight such blocks as comments while they do not highlight strings used as comments as comments.

It is an interesting observation that to use it to comment out a block of code one should use the raw string version.  Hopefully the existence of this issue will make that slightly more discoverable.

----------
nosy: +r.david.murray
title: Python fails to parse commented out code -> Python fails to parse triple quoted (commented out) code

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31253>
_______________________________________


More information about the Python-bugs-list mailing list