You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 0_preface.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -236,7 +236,7 @@ <h2>Changes in the second and third editions<a class="headerlink" href="#changes
236
236
workspaces in <aclass="reference internal" href="2_programs_in_files.html#workspaces"><spanclass="std std-numref">Section 2.2.1</span></a>, and the Flake8 extension in
237
237
<aclass="reference internal" href="4_style.html#flake8-extension"><spanclass="std std-numref">Section 4.2.2</span></a>. Together, these provide correctly integrated code
238
238
linting. It also consistently uses <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">python</span><spanclass="pre">-m</span></code> to invoke tools such as <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">pip</span></code>,
239
-
<aclass="reference external" href="https://docs.pytest.org/en/latest/index.html#module-pytest" title="(in pytest v8.5.0.dev188)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">pytest</span></code></a> and <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">flake8</span></code>. This is less error-prone for students. The description
239
+
<aclass="reference external" href="https://docs.pytest.org/en/latest/index.html#module-pytest" title="(in pytest v8.5.0.dev210)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">pytest</span></code></a> and <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">flake8</span></code>. This is less error-prone for students. The description
240
240
of <aclass="reference external" href="https://docs.python.org/3/reference/compound_stmts.html#finally" title="(in Python v3.14)"><codeclass="xref std std-keyword docutils literal notranslate"><spanclass="pre">finally</span></code></a> in <aclass="reference internal" href="6_exceptions.html#else-finally"><spanclass="std std-numref">Section 6.5.2</span></a> has been also improved.</p>
<p>There are a number of Python packages which support code testing. The concepts
718
718
are largely similar so rather than get bogged down in the details of multiple
719
-
frameworks, we will introduce <aclass="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v8.5.0.dev188)"><spanclass="xref std std-doc">Pytest</span></a>, which is one of the
719
+
frameworks, we will introduce <aclass="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v8.5.0.dev210)"><spanclass="xref std std-doc">Pytest</span></a>, which is one of the
720
720
most widely used. Pytest is simply a Python package, so you can install it into
Copy file name to clipboardExpand all lines: 9_trees_and_directed_acyclic_graphs.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -694,10 +694,10 @@ <h3><span class="section-number">9.4.2. </span>Operations on expression trees<a
694
694
code to execute, depending on the type of the first argument <aclass="footnote-reference brackets" href="#single" id="id3" role="doc-noteref"><spanclass="fn-bracket">[</span>3<spanclass="fn-bracket">]</span></a>.</p>
695
695
<p><aclass="reference internal" href="#tree-evaluate"><spanclass="std std-numref">Listing 9.7</span></a> shows a single dispatch function for a visitor function
696
696
which evaluates a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Expression</span></code>. Start with lines 6-24. These define a
697
-
function <aclass="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code></a> which will be used in
697
+
function <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code> which will be used in
698
698
the default case, that is, in the case where the <aclass="reference external" href="https://docs.python.org/3/library/functions.html#type" title="(in Python v3.14)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">type</span></code></a> of the first
699
699
argument doesn’t match any of the other implementations of
700
-
<aclass="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code></a>. In this case, the first
700
+
<codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code>. In this case, the first
701
701
argument is the expression that we’re evaluating, so if the type doesn’t match
702
702
then this means that we don’t know how to evaluate this object, and the only
703
703
course of action available is to throw an <aclass="reference internal" href="6_exceptions.html#term-exception"><spanclass="xref std std-term">exception</span></a>.</p>
@@ -783,13 +783,13 @@ <h3><span class="section-number">9.4.2. </span>Operations on expression trees<a
783
783
Notice that the function name is given as <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">_</span></code>. This is the Python convention for
784
784
a name which will never be used. This function will never be called by its
785
785
declared name. Instead, look at the decorator on line 28. The single dispatch
786
-
function <aclass="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code></a> has a <aclass="reference internal" href="3_objects.html#term-method"><spanclass="xref std std-term">method</span></a>
786
+
function <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">evaluate()</span></code> has a <aclass="reference internal" href="3_objects.html#term-method"><spanclass="xref std std-term">method</span></a>
787
787
<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">register()</span></code>. When used as a decorator, the <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">register()</span></code> method of a
788
788
single dispatch function registers the function that follows as implementation
789
789
for the <aclass="reference external" href="https://docs.python.org/3/reference/compound_stmts.html#class" title="(in Python v3.14)"><codeclass="xref std std-keyword docutils literal notranslate"><spanclass="pre">class</span></code></a> given as an argument to <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">register()</span></code>. On this
790
790
occasion, this is <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">expressions.Number</span></code>.</p>
791
791
<p>Now look at lines 33-35. These contain the implementation of
<p>Write a <aclass="reference internal" href="#term-single-dispatch-function"><spanclass="xref std std-term">single dispatch function</span></a> importable as
1126
1126
<codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">expressions.differentiate()</span></code> which has the correct interface to be
1127
1127
passed to <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">expressions.postvisitor()</span></code> or
1128
-
<aclass="reference internal" href="example_code.html#example_code.expression_tools.postvisitor" title="example_code.expression_tools.postvisitor"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">example_code.expression_tools.postvisitor()</span></code></a> and which differentiates the
1128
+
<codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">example_code.expression_tools.postvisitor()</span></code> and which differentiates the
1129
1129
expression provided with respect to a symbol whose name is passed as the
<p>As a simplification, the tests will assume that <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">var</span></code> does not appear in an
0 commit comments