A case for "real" multiline comments

Jordan Perr jordan at jperr.com
Wed Apr 18 22:07:34 EDT 2012


I came across this case while debugging some Python code that contained an
error stemming from the use of multiline strings as comments. The code
contained a very long list of objects, and I had commented out some of the
objects using the multiline string. This caused a string to be appended to
the list instead of ignoring the section. Consider the following code:

list = [
Object1(arg),
"""
Object2(arg),
Object3(arg),
"""
Object4(arg)
]

Real multiline comments would produce [Object1, Object4]. The list, in
fact, contains [Object1, "Object2, Object3", Object4]. I can't really see a
good way to get around this without true multiline comments.

- Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120418/c45039ac/attachment.html>


More information about the Python-list mailing list