← every case · 2000 · string forms

2090-docstring_holding_a_comment_symbol

the # inside the docstring is text and not a comment symbol, and the docstring around it is a triple quoted string like any other, opening a line on its own. Case 2100 is the same shape where the block is data the program prints, and the two together separate a counter that decides by where the block sits from one that decides by what it is

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.py
1codedef f():
2comments """
3comments # this is not a comment, it is inside the docstring
4comments """
5code return 1

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask5 lines · 0 blanks · 2 code · 3 comments
it answers5 lines · 0 blanks · 2 code · 3 comments

cloc --json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py

mezura.content ✓ agrees
the rules ask5 lines · 5 code · 0 comments · 0 extra
it answers5 lines · 5 code · 0 comments · 0 extra

mezura cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py --output json --hide timing --counting content

mezura.region ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

mezura cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py --output json --hide timing --counting region

scc.default ✓ agrees

any triple quoted block that opens a line is read as documentation, so the three lines of this one are comments by the definition it declares and not by a mistake

the rules ask5 lines · 0 blanks · 2 code · 3 comments
it answers5 lines · 0 blanks · 2 code · 3 comments

scc --format json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py

tokei.default ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

tokei --output json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py