Skip to content

Commit 297b74d

Browse files
committed
some more steps into exceptions
1 parent 56d1ac9 commit 297b74d

File tree

7 files changed

+560
-61
lines changed

7 files changed

+560
-61
lines changed

bibliography/bibliography.bib

+196-44
Large diffs are not rendered by default.

notation/acronyms.sty

+4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
%
55
\newacronym[description={Artificial Intelligence, see, e.g.,~\cite{RN2022AIAMA}}]{AI}{AI}{Artificial Intelligence}%
66
\newacronym[description={Data Science, see, e.g.,~\cite{G2019DSFSFPWP}}]{DS}{DS}{Data Science}%
7+
\newacronym[description={Garbage In--Garbage Out, see, e.g.,~\cite{PKBCBR2005GIGOAELAOMBEUP}}]{GIGO}{GIGO}{Garbage In--Garbage Out}
78
\newacronym[description={Integrated Development Environment, see \gls{ide}}]{IDE}{IDE}{Integrated Development Environment}%
89
\newacronym[description={Machine Learning, see, e.g.,~\cite{SSBD2014UMLFTTA}}]{ML}{ML}{Machine Learning}%
910
\newacronym[description={Operating System, the system that runs your computer, see, e.g., \linux\ and \windows}]{OS}{OS}{Operating System}%
11+
\newacronym[description={see \gls{stderrs} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stderr}]{stderr}{\texttt{stderr}}{standard error stream}%
12+
\newacronym[description={see \gls{stdins} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stdin}]{stdin}{\texttt{stdin}}{standard input stream}%
13+
\newacronym[description={see \gls{stdouts} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stdout}]{stdout}{\texttt{stdout}}{standard output stream}%
1014
\newacronym[description={Version Control Systems, see \gls{vcs}}]{VCS}{VCS}{Version Control Systems}%
1115
%

notation/terms.sty

+32-3
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,43 @@ See \cref{sec:howFloatingPointNumbersWork}.%
153153
}%
154154
}%
155155
%
156+
\newglossaryentry{stderrs}{%
157+
name={standard error stream},%
158+
description={%
159+
The \acrfull{stderr} is one of the three pre-defined streams of a console process (together with the \gls{stdins} and the \gls{stdouts})~\cite{J2024PTOGBSI8IS12ESSSSIS}. %
160+
It is the text stream to which the process writes information about errors and exceptions. %
161+
If an uncaught \pythonilIdx{Exception} is raised in \python\ and the program terminates, then this information is written to \pgls{stderr}. %
162+
If you run a program in a \pgls{terminal}, then the text that a process writes to its \pgls{stderr} appears in the console.%
163+
}%
164+
}%
165+
%
166+
\newglossaryentry{stdins}{%
167+
name={standard input stream},%
168+
description={%
169+
The \acrfull{stdin} is one of the three pre-defined streams of a console process (together with the \pgls{stdouts} and the \pgls{stderrs})~\cite{J2024PTOGBSI8IS12ESSSSIS}. %
170+
It is the text stream from which the process reads its input text, if any. %
171+
The \python\ instruction \pythonilIdx{input} reads from this stream. %
172+
If you run a program in a \pgls{terminal}, then the text that you type into the terminal while the process is running appears in this stream.%
173+
}%
174+
}%
175+
%
176+
\newglossaryentry{stdouts}{%
177+
name={standard output stream},%
178+
description={%
179+
The \acrfull{stdout} is one of the three pre-defined streams of a console process (together with the \pgls{stdins} and the \pgls{stderrs})~\cite{J2024PTOGBSI8IS12ESSSSIS}. %
180+
It is the text stream to which the process writes its normal output. %
181+
The \pythonilIdx{print} instruction of \python\ writes text to this stream. %
182+
If you run a program in a \pgls{terminal}, then the text that a process writes to its \pgls{stdout} appears in the console.%
183+
}%
184+
}%
156185
%
157186
\newglossaryentry{sudo}{%
158187
text={\texttt{sudo}},%
159188
name={sudo},%
160189
sort={sudo},%
161190
description={%
162191
In order to perform administrative tasks such as installing new software under \linux, root (or ``super'') user privileges as needed~\cite{CN2020ULB}. %
163-
A normal user can execute a program in the \gls{terminal} as super user by pre-pending \bashil{sudo}, often referred to as ``super user do.'' %
192+
A normal user can execute a program in the \pgls{terminal} as super user by pre-pending \bashil{sudo}, often referred to as ``super user do.'' %
164193
This requires the root password.%
165194
}%
166195
}%
@@ -209,8 +238,8 @@ name={Version Control System},%
209238
plural={Version Control Systems},%
210239
description={%
211240
A \acrfull{VCS} is a software which allows you to manage and preserve the historical development of your program code~\cite{T2024BGAGVCPMATFTND}. %
212-
A distributed \gls{VCS} allows multiple users to work on the same code and upload their changes to the server, which then preserves the change history.
213-
The most popular distributed \gls{VCS} is \gls{git}.%
241+
A distributed \pgls{VCS} allows multiple users to work on the same code and upload their changes to the server, which then preserves the change history.
242+
The most popular distributed \pgls{VCS} is \pgls{git}.%
214243
}%
215244
}%
216245
%

styles/listing.sty

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ breaklines=true%
247247
%
248248
$\downarrow$~~\expandafter\bashil{python3 #3}~~$\downarrow$%
249249
%
250-
\lstinputlisting[label={exec:#5},style=text_style,caption={The standard output of the program~\href{\csname @pwp@gitUrl:lst:#5\endcsname}{\textil{#3}} given in~\cref{lst:#5}.}]{\csname @pwp@gitFile:exec:#5\endcsname}%
250+
\lstinputlisting[label={exec:#5},style=text_style,caption={The \gls{stdout} of the program~\href{\csname @pwp@gitUrl:lst:#5\endcsname}{\textil{#3}} given in~\cref{lst:#5}.}]{\csname @pwp@gitFile:exec:#5\endcsname}%
251251
\end{figure}%
252252
}%
253253
%
@@ -275,7 +275,7 @@ $\downarrow$~~\expandafter\bashil{python3 #3}~~$\downarrow$%
275275
%
276276
$\downarrow$~~\expandafter\bashil{python3 #3}~~$\downarrow$%
277277
%
278-
\lstinputlisting[label={exec:#5},style=text_style,caption={The standard output and error as well as the exit code of the program~\href{\csname @pwp@gitUrl:lst:#5\endcsname}{\textil{#3}} given in~\cref{lst:#5}.}]{\csname @pwp@gitFile:exec:#5\endcsname}%
278+
\lstinputlisting[label={exec:#5},style=text_style,caption={The \gls{stdout} and \gls{stderr} as well as the exit code of the program~\href{\csname @pwp@gitUrl:lst:#5\endcsname}{\textil{#3}} given in~\cref{lst:#5}.}]{\csname @pwp@gitFile:exec:#5\endcsname}%
279279
\end{figure}%
280280
}%
281281
%

text/main/basics/variables/assignment/assignment.tex

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
\begin{sloppypar}%
117117
We can use \pythonil{int_var} just like any other value.
118118
For example, we can compute \pythonil{2 + int_var} and pass the result to the \pythonilIdx{print} function.
119-
This will then print \pythonil{3} to the standard output of our program.
119+
This will then print \pythonil{3} to the \pgls{stdout} of our program.
120120
We can also use \pythonil{int_var} in \pglspl{fstring}\pythonIdx{f-string}\pythonIdx{str!f} about which we leared back in \cref{sec:fstrings}.
121121
\pythonil{f"int_var has value \{int_var\}."} will render to \pythonil{"int_var has value 1."}.%
122122
\end{sloppypar}%
@@ -128,7 +128,7 @@
128128
In this computation, the current (old) value of \pythonil{int_var} is used.
129129
It therefore corresponds to computing \pythonil{(3 * 1) + 1}, which equals~\pythonil{4}.
130130
This value is stored somewhere in memory and \pythonil{int_var} points to it.
131-
Doing \pythonil{print(f"int_var is now \{int_var\}.")} will print \textil{int_var is now 4.} to the standard output.
131+
Doing \pythonil{print(f"int_var is now \{int_var\}.")} will print \textil{int_var is now 4.} to the \pgls{stdout}.
132132
The value \pythonil{1} is now no longer referenced.
133133
Eventually, the \python\ interpreter could free the corresponding memory to use it for something else.
134134

@@ -145,7 +145,7 @@
145145
Finally, \pythonil{print(f"new_var = \{new_var\}." )} then prints \textil{new_var = 14.0.}.%
146146
\end{sloppypar}%
147147
%
148-
The standard output of the complete program is given in \cref{exec:variables:assignment}.
148+
The \acrfull{stdout} of the complete program is given in \cref{exec:variables:assignment}.
149149
For your convenience, we also showed the results when executing the program in \pycharm\ or the \ubuntu\ \pgls{terminal} in \cref{fig:variables:assignment}.
150150
They are obviously identical.
151151

@@ -279,10 +279,10 @@
279279
In each iteration of the approximation, we simply set \pythonil{e *= 2}\pythonIdx{*=}, which is equivalent to \pythonil{e = e * 2}, to double the number of edges.
280280
We compute \pythonil{s = sqrt(2 - sqrt(4 - (s ** 2)))}\pythonIdx{sqrt} having imported\pythonIdx{import} the \pythonilIdx{sqrt} function from the \pythonilIdx{math} module.
281281
We print the approximated value of~\numberPi\ as \pythonil{e * s / 2}.
282-
Notice how elegantly we use the unicode characters~$\pi$ and~$\approx$ via the escapes~\pythonil{\\u03c0} and \pythonil{\\u2248}\pythonIdx{\textbackslash{u}}, respectively, from back in~\cref{sec:unicodeChars} (and how nicely it indeed prints the greek character~$\pi$ in the standard output in \cref{exec:variables:pi_liu_hui}).
282+
Notice how elegantly we use the unicode characters~$\pi$ and~$\approx$ via the escapes~\pythonil{\\u03c0} and \pythonil{\\u2248}\pythonIdx{\textbackslash{u}}, respectively, from back in~\cref{sec:unicodeChars} (and how nicely it indeed prints the greek character~$\pi$ in the \pgls{stdout} in \cref{exec:variables:pi_liu_hui}).
283283
Either way, since \cref{eq:liuhui:sidelength,eq:liuhui:approx} are always the same, we can simply copy-paste the lines of code for updating~\pythonil{s}, \pythonil{e}, and printing the approximated value of~\numberPi\ several times.
284284

285-
\Cref{exec:variables:pi_liu_hui} shows the standard output produced by this program.
285+
\Cref{exec:variables:pi_liu_hui} shows the \acrfull{stdout} produced by this program.
286286
Indeed, each new approximation comes closer to~\numberPi.
287287
For 192~edges, we get the approximation~\pythonil{3.1414524722853443}.
288288
Given that the constant~\pythonilIdx{pi} from the \pythonilIdx{math} module is \pythonil{3.141592653589793}, we find that the first four digits are correct and that the number is only off by only 0.0045\%!

0 commit comments

Comments
 (0)