Group comment
Skip Montanaro
skip at pobox.com
Mon Mar 1 09:57:56 EST 2004
ketulp> Can I comment a group of statements together i.e
ketulp> If I a 4 statements say:
ketulp> i=1
ketulp> i+=1
ketulp> print i
ketulp> print i+1
ketulp> Instead of commenting each satement iindividually by # is there
ketulp> something which allws me to comment these 4 statements in one go
ketulp> as in C++ using /*...*/
Many people use triple-quoted strings for this:
"""
i=1
i+=1
print i
print i+1
"""
It's not a comment, strictly speaking, however it generally achieves the
desired results. Even less comment-like is "if False:":
if False:
i=1
i+=1
print i
print i+1
That has the disadvantage that you need to reindent the lines of interest.
Skip
More information about the Python-list
mailing list