Skip to content

Commit 9377638

Browse files
author
alexey
committed
Improve query help
1 parent 86ec047 commit 9377638

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/ql/src/Statements/ReturnOrYieldOutsideFunction.qhelp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Consequently, it is not possible to suggest a general fix.</p>
1717
<example>
1818
<p>In this example, a <code>return</code> statement is used outside a class method in a class and
1919
a <code>yield</code> statement is used outside a function in a scope of a module which would result
20-
in a <code>SyntaxError</code> when running this code.</p>
20+
in a <code>SyntaxError</code> when running this code.
21+
22+
In this example, the invalid class could be corrected by placing the <code>return</code> statement
23+
in a class method, or by refactoring the class into a function. The invalid <code>yield</code> statement
24+
could become part of a new generator function containing the <code>for</code> loop.</p>
2125
<sample src="ReturnOrYieldOutsideFunction.py" />
2226
</example>
2327

0 commit comments

Comments
 (0)