Skip to content

Commit 530469a

Browse files
committed
minor improvement
1 parent 265e686 commit 530469a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

text/main/basics/variables/typesAndTypeHints/typesAndTypeHints.tex

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787
\end{figure}%
8888
%
8989
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables variable_types_wrong.py}{variables:variable_types_wrong:mypy}{%
90-
The results of static type checking with \mypy\ of the program given in \cref{lst:variables:types_wrong}. %
90+
The results of static type checking with \mypy\ of the program \textil{variable_types_wrong.py} given in \cref{lst:variables:types_wrong}. %
9191
(This is actually output generated by the script~\cref{lst:bash:mypy} on \cpageref{lst:bash:mypy}.)}%
9292
%
9393
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables variable_types.py}{variables:variable_types:mypy}{%
94-
The results of static type checking with \mypy\ of the program given in \cref{lst:variables:types}. %
94+
The results of static type checking with \mypy\ of the program \textil{variable_types.py} given in \cref{lst:variables:types}. %
9595
(This is actually output generated by the script~\cref{lst:bash:mypy} on \cpageref{lst:bash:mypy}.)}%
9696
%
9797
A first step to avoiding any type-related errors in programs is, ofcourse, careful programming.
@@ -173,10 +173,10 @@
173173
\cref{lst:variables:types_wrong}, but with the variable explicitly hinted as either \pythonil{int} or \pythonil{float} and named appropriately.}%
174174
%
175175
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables variable_types_wrong_hints_1.py}{variables:variable_types_wrong_hints_1:mypy}{%
176-
The results of static type checking with \mypy\ of the program given in \cref{lst:variables:types_wrong_hints_1}.}%
176+
The results of static type checking the program \textil{variable_types_wrong_hints_1.py} with \mypy\ of the program given in \cref{lst:variables:types_wrong_hints_1}.}%
177177
%
178178
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables variable_types_wrong_hints_2.py}{variables:variable_types_wrong_hints_2:mypy}{%
179-
The results of static type checking with \mypy\ of the program given in \cref{lst:variables:types_wrong_hints_2}.}%%
179+
The results of static type checking the program \textil{variable_types_wrong_hints_2.py} with \mypy\ of the program given in \cref{lst:variables:types_wrong_hints_2}.}%%
180180

181181
If the author of \cref{lst:variables:types_wrong} had used \pglspl{typeHint}, they could have written their program differently, as illustrated in \cref{lst:variables:types_wrong_hints_1,lst:variables:types_wrong_hints_2}.
182182
Both programs as well as the original one produce exactly the same output if we execute them with the \python\ interpreter, since \pglspl{typeHint} are ignored by the interpreter.
@@ -220,7 +220,7 @@
220220
A variant of \cref{lst:variables:types} which has been improved by adding type annotations.}%
221221
%
222222
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables variable_types_hints.py}{variables:variable_types_hints:mypy}{%
223-
The results of static type checking with \mypy\ of the program \textil{variable_types_hints} given in \cref{lst:variables:types_hints}.}
223+
The results of static type checking with \mypy\ of the program \textil{variable_types_hints.py} given in \cref{lst:variables:types_hints}.}
224224

225225
For the sake of completeness, let us also annotate \cref{lst:variables:types} with \pglspl{typeHint} as a small exercise.
226226
The variable \pythonil{int_var}, in which we want to store the integer value~\pythonil{8}, will be annotated with \pythonil{: int}.
@@ -243,7 +243,7 @@
243243
Therefore, from my perspective, \cref{bp:typeHints} \emph{always} applies.
244244

245245
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh variables assignment_wrong.py}{variables:assignment_wrong:mypy}{%
246-
The results of static type checking with \mypy\ of the program \textil{assignment_wrong} given in \cref{lst:variables:assignment_wrong}.}%
246+
The results of static type checking the program \textil{assignment_wrong.py} with \mypy\ given in \cref{lst:variables:assignment_wrong}.}%
247247
%
248248
For the sake of completeness, we also apply \mypy\ to the program \textil{assignment_wrong} given in \cref{lst:variables:assignment_wrong} that we used to illustrate the use of the \pycharm\ \pgls{IDE} in finding bugs.
249249
The output given in \cref{exec:variables:assignment_wrong:mypy} informs us about the same error we encountered back in \cref{sec:errorsInIde}:

0 commit comments

Comments
 (0)