Skip to content

Commit 39b152c

Browse files
committed
fixed indexing of !r
1 parent d87889e commit 39b152c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

styles/myindex.sty

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
%
1515
%% dots without end-of-sentence spacing at the end
1616
\protected\gdef\idxdots{%
17-
\texorpdfstring{%
1817
.\kern\fontdimen3\font%
1918
.\kern\fontdimen3\font%
20-
.\@\strut}{{.}{.}{.}}}%
19+
.\@\strut}%
2120
%

text/main/controlFlow/loops/loops.tex

+3-3
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@
215215
Remember that sets in \python\ are unordered (see \cref{bp:setsUnordered}), which means that if we run the program twice, we may get different results.
216216
Either way, we can iterate over all the values in the set~\pythonil{st}.
217217
We again want to store these values as nicely formatted strings in~\pythonil{txt}.
218-
This time we use the \pgls{fstring} \pythonil{f"s=\{s!r\}"}.
219-
Notice the \pythonil{!r} format specifier\pythonIdx{!r}:
218+
This time we use the \pgls{fstring} \pythonil{f"s=\{s!r\}"}\pythonIdx{"!r}.
219+
Notice the \pythonil{!r} format specifier\pythonIdx{"!r}:
220220
It will print the \emph{representation} of the string~\pythonil{s}, which basically means to put quotation marks (and to potentially escape\pythonIdx{str!escaping}\pythonIdx{escaping} otherwise unprintable characters, see \cref{sec:str:escaping}).
221221
Thus, we will add \pythonil{"s='v'"}, \pythonil{"s='u'"}, and~\pythonil{"s='w'"} to \pythonil{txt} (in an arbitrary order).
222222

@@ -509,7 +509,7 @@
509509
Now if neither \pythonil{mid_str < search} nor \pythonil{mid_str > search} were \pythonil{True}, it must be that \pythonil{mid_str == search}.
510510
This means that we found the location of \pythonil{search} -- it is at the index~\pythonil{mid}.
511511
Therefore, we print this result to the output.
512-
(Notice that the \pythonilIdx{!r} format specifiers in the \pgls{fstring} we use add the nice single quotes around \pythonil{search} and \pythonil{data}.)
512+
(Notice that the \pythonil{!r}\pythonIdx{"!r} format specifiers in the \pgls{fstring} we use add the nice single quotes around \pythonil{search} and \pythonil{data}.)
513513
After printing the information, we exit the \pythonilIdx{while} loop using the \pythonilIdx{break} statement.%
514514
\end{sloppypar}%
515515
%

0 commit comments

Comments
 (0)