File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,23 @@ This example accidentally calls ``sort()`` instead of :py:func:`sorted`:
8989
9090 x = sort([3 , 2 , 4 ]) # Error: Name "sort" is not defined [name-defined]
9191
92+
93+ Check that a variable is not used before it's defined [used-before-def]
94+ -----------------------------------------------------------------------
95+
96+ Mypy will generate an error if a name is used before it's defined.
97+ While the name-defined check will catch issues with names that are undefined,
98+ it will not flag if a variable is used and then defined later in the scope.
99+ used-before-def check will catch such cases.
100+
101+ Example:
102+
103+ .. code-block :: python
104+
105+ print (x) # Error: Name "x" is used before definition [used-before-def]
106+ x = 123
107+
108+
92109 Check arguments in calls [call-arg]
93110-----------------------------------
94111
You can’t perform that action at this time.
0 commit comments