Skip to content

Commit 4a6f5a3

Browse files
committed
Website build
1 parent 787a00e commit 4a6f5a3

13 files changed

+115
-165
lines changed

0_preface.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ <h2>Changes in the second and third editions<a class="headerlink" href="#changes
236236
workspaces in <a class="reference internal" href="2_programs_in_files.html#workspaces"><span class="std std-numref">Section 2.2.1</span></a>, and the Flake8 extension in
237237
<a class="reference internal" href="4_style.html#flake8-extension"><span class="std std-numref">Section 4.2.2</span></a>. Together, these provide correctly integrated code
238238
linting. It also consistently uses <code class="xref py py-obj docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span></code> to invoke tools such as <code class="xref py py-obj docutils literal notranslate"><span class="pre">pip</span></code>,
239-
<a class="reference external" href="https://docs.pytest.org/en/latest/index.html#module-pytest" title="(in pytest v8.5.0.dev188)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pytest</span></code></a> and <code class="xref py py-obj docutils literal notranslate"><span class="pre">flake8</span></code>. This is less error-prone for students. The description
239+
<a class="reference external" href="https://docs.pytest.org/en/latest/index.html#module-pytest" title="(in pytest v8.5.0.dev210)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pytest</span></code></a> and <code class="xref py py-obj docutils literal notranslate"><span class="pre">flake8</span></code>. This is less error-prone for students. The description
240240
of <a class="reference external" href="https://docs.python.org/3/reference/compound_stmts.html#finally" title="(in Python v3.14)"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> in <a class="reference internal" href="6_exceptions.html#else-finally"><span class="std std-numref">Section 6.5.2</span></a> has been also improved.</p>
241241
</section>
242242
</section>

2_programs_in_files.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ <h2><span class="section-number">2.5. </span>Testing frameworks<a class="headerl
716716
including tests in your code here.</p>
717717
<p>There are a number of Python packages which support code testing. The concepts
718718
are largely similar so rather than get bogged down in the details of multiple
719-
frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v8.5.0.dev188)"><span class="xref std std-doc">Pytest</span></a>, which is one of the
719+
frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v8.5.0.dev210)"><span class="xref std std-doc">Pytest</span></a>, which is one of the
720720
most widely used. Pytest is simply a Python package, so you can install it into
721721
your current environment using:</p>
722722
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(PoP_venv)</span> <span class="gp">$ </span>python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>pytest

9_trees_and_directed_acyclic_graphs.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,10 +694,10 @@ <h3><span class="section-number">9.4.2. </span>Operations on expression trees<a
694694
code to execute, depending on the type of the first argument <a class="footnote-reference brackets" href="#single" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>.</p>
695695
<p><a class="reference internal" href="#tree-evaluate"><span class="std std-numref">Listing 9.7</span></a> shows a single dispatch function for a visitor function
696696
which evaluates a <code class="xref py py-class docutils literal notranslate"><span class="pre">Expression</span></code>. Start with lines 6-24. These define a
697-
function <a class="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code></a> which will be used in
697+
function <code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code> which will be used in
698698
the default case, that is, in the case where the <a class="reference external" href="https://docs.python.org/3/library/functions.html#type" title="(in Python v3.14)"><code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></a> of the first
699699
argument doesn’t match any of the other implementations of
700-
<a class="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code></a>. In this case, the first
700+
<code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code>. In this case, the first
701701
argument is the expression that we’re evaluating, so if the type doesn’t match
702702
then this means that we don’t know how to evaluate this object, and the only
703703
course of action available is to throw an <a class="reference internal" href="6_exceptions.html#term-exception"><span class="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
783783
Notice that the function name is given as <code class="xref py py-obj docutils literal notranslate"><span class="pre">_</span></code>. This is the Python convention for
784784
a name which will never be used. This function will never be called by its
785785
declared name. Instead, look at the decorator on line 28. The single dispatch
786-
function <a class="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code></a> has a <a class="reference internal" href="3_objects.html#term-method"><span class="xref std std-term">method</span></a>
786+
function <code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code> has a <a class="reference internal" href="3_objects.html#term-method"><span class="xref std std-term">method</span></a>
787787
<code class="xref py py-meth docutils literal notranslate"><span class="pre">register()</span></code>. When used as a decorator, the <code class="xref py py-meth docutils literal notranslate"><span class="pre">register()</span></code> method of a
788788
single dispatch function registers the function that follows as implementation
789789
for the <a class="reference external" href="https://docs.python.org/3/reference/compound_stmts.html#class" title="(in Python v3.14)"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">class</span></code></a> given as an argument to <code class="xref py py-meth docutils literal notranslate"><span class="pre">register()</span></code>. On this
790790
occasion, this is <code class="xref py py-class docutils literal notranslate"><span class="pre">expressions.Number</span></code>.</p>
791791
<p>Now look at lines 33-35. These contain the implementation of
792-
<a class="reference internal" href="example_code.html#example_code.expression_tools.evaluate" title="example_code.expression_tools.evaluate"><code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code></a> for <code class="xref py py-class docutils literal notranslate"><span class="pre">expressions.Symbol</span></code>.
792+
<code class="xref py py-func docutils literal notranslate"><span class="pre">evaluate()</span></code> for <code class="xref py py-class docutils literal notranslate"><span class="pre">expressions.Symbol</span></code>.
793793
In order to evaluate a symbol, we depend on the mapping from symbol names to
794794
numerical values that has been passed in.</p>
795795
<p>Finally, look at lines 38-40. These define the evaluation visitor for addition.
@@ -1125,7 +1125,7 @@ <h2><span class="section-number">9.9. </span>Exercises<a class="headerlink" href
11251125
<p>Write a <a class="reference internal" href="#term-single-dispatch-function"><span class="xref std std-term">single dispatch function</span></a> importable as
11261126
<code class="xref py py-func docutils literal notranslate"><span class="pre">expressions.differentiate()</span></code> which has the correct interface to be
11271127
passed to <code class="xref py py-func docutils literal notranslate"><span class="pre">expressions.postvisitor()</span></code> or
1128-
<a class="reference internal" href="example_code.html#example_code.expression_tools.postvisitor" title="example_code.expression_tools.postvisitor"><code class="xref py py-func docutils literal notranslate"><span class="pre">example_code.expression_tools.postvisitor()</span></code></a> and which differentiates the
1128+
<code class="xref py py-func docutils literal notranslate"><span class="pre">example_code.expression_tools.postvisitor()</span></code> and which differentiates the
11291129
expression provided with respect to a symbol whose name is passed as the
11301130
string <a class="reference external" href="https://docs.python.org/3/glossary.html#term-argument" title="(in Python v3.14)"><span class="xref std std-term">keyword argument</span></a> <code class="xref py py-obj docutils literal notranslate"><span class="pre">var</span></code>.</p>
11311131
<p>As a simplification, the tests will assume that <code class="xref py py-obj docutils literal notranslate"><span class="pre">var</span></code> does not appear in an

_modules/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
<h1>All modules for which code is available</h1>
6060
<ul><li><a href="example_code/addable.html">example_code.addable</a></li>
6161
<li><a href="example_code/euclid.html">example_code.euclid</a></li>
62-
<li><a href="example_code/expression_tools.html">example_code.expression_tools</a></li>
6362
<li><a href="example_code/graphs.html">example_code.graphs</a></li>
6463
<li><a href="example_code/groups.html">example_code.groups</a></li>
6564
<li><a href="example_code/groups_abc.html">example_code.groups_abc</a></li>

_sources/exercises.rst.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ If you are using this book as a part of a course where the instructor provides
1313
GitHub Classroom assignments for the exercises, you should not use the links
1414
here but rather use the Classroom links provided by your instructor. Students
1515
taking Principles of Programming at Imperial College London will find their
16-
list of GitHub Classroom links `on Blackboard
17-
<https://bb.imperial.ac.uk/ultra/courses/_37896_1/cl/outline>`__.
16+
list of GitHub Classroom links on Blackboard.
1817

1918

2019
* `Chapter 2 exercises <https://github.com/object-oriented-python/exercises-chapter-2>`__

_sources/tests_and_exams.rst.txt

Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ Python documentation for any features they suggest.
2121
Test format
2222
-----------
2323

24-
The final exam will be two hours long and comprise 4 questions, each of which
25-
will be marked out of 20. The midterm test will be 40 minutes long, so to keep
26-
the question format consistent with the final exam, there will a single
27-
question. The extra 10 minutes is to give you some flexibility, because in the
28-
final exam you could spend more time on some questions than others. The
29-
question will be subdivided into identified parts with a specified number of
30-
marks associated with each.
24+
The final exam will be two hours long and comprise 3 questions, each of which
25+
will be marked out of 20. The midterm test will be 40 minutes long and there
26+
will a single question. The question will be subdivided into identified parts
27+
with a specified number of marks associated with each.
3128

3229
.. The test will work using GitHub Classroom. The link to accept the test
3330
.. "assignment" will be distributed at the start time of the test, simultaneously
@@ -48,53 +45,53 @@ of flake8 and disregard any false positives. The other 2 marks will be allocated
4845
on a similar basis for basic style matters that flake8 cannot check, such as
4946
conforming with naming conventions and commenting appropriately.
5047

51-
The remaining 16 marks will be allocated to the various parts of the questions. As with a
52-
written maths test, getting the correct final answer is necessary but not
53-
sufficient. A full marks answer to a question will be functionally correct, have
54-
optimal :term:`algorithmic complexity`, and be elegant and readable. The tests
55-
provided are an aid to writing correct code: passing the tests does not prove
56-
that your answer is correct. For example, your code could produce the correct
57-
output in the cases tested but nonetheless fail to implement the specification in
58-
the question. For the avoidance of doubt, a correct answer is one which
59-
correctly implements the specification, not simply one which passes the tests
60-
provided.
48+
The remaining 16 marks will be allocated to the various parts of the questions.
49+
As with a written maths test, getting the correct final answer is necessary but
50+
not sufficient. A full marks answer to a question will be functionally correct,
51+
have optimal :term:`algorithmic complexity`, and be elegant and readable. The
52+
tests provided are an aid to writing correct code: passing the tests does not
53+
prove that your answer is correct. For example, your code could produce the
54+
correct output in the cases tested but nonetheless fail to implement the
55+
specification in the question. For the avoidance of doubt, a correct answer is
56+
one which correctly implements the specification, not simply one which passes
57+
the tests provided.
6158

6259
As a rough guide, a solution which produced the correct output but was very
6360
inelegantly written (for example taking many too many steps to achieve simple
6461
functionality) and which used a suboptimal algorithm could be expected to earn
6562
half of the marks available for a question.
6663

67-
.. Using Git in the test
68-
.. ---------------------
69-
70-
.. You should accept the test from GitHub Classroom, and clone the test repository
71-
.. into the folder you created for the course, just like you have been doing for
72-
.. the exercise repositories. This will help ensure that you are programming in
73-
.. the same environment you have been using all along, and therefore avoid any
74-
.. unfortunate misconfiguration surprises in the test.
75-
76-
.. This is a test of programming as a whole, so using Git correctly is a part of
77-
.. the test. This has some consequences for how you should go about the test:
78-
79-
.. 1. Commit *and* push your work as you go along. Do not rely on committing once
80-
.. at the end of the test. You will be marked on what you have pushed to GitHub
81-
.. at the end of the test period. If the first time that you try to push
82-
.. something to GitHub is at the end of the test time, and something goes wrong, then
83-
.. you will receive 0% for the test, because you will not have pushed any
84-
.. answers.
85-
.. 2. Don't forget to `git add` any files you need to create. If you don't add them
86-
.. to the repository, they won't be pushed and therefore they won't be marked.
87-
88-
.. .. warning::
89-
90-
.. If you commit and push often as you go through the test then not only will
91-
.. you know that you have some marks in the bank already, but you will have a
92-
.. record of what you had done at each point in time. In the unlikely event of a failure outside your
93-
.. control, such as your network failing or GitHub going down, it will be very
94-
.. easy to assign the correct marks to students who have already pushed a large
95-
.. part of their work to GitHub. At the other extreme, it will be difficult to
96-
.. ascribe any credit at all to students with no pushed work who then push a
97-
.. single commit to GitHub after the time has expired.
64+
Using Git in the test
65+
---------------------
66+
67+
You should accept the test from GitHub Classroom, and clone the test repository
68+
into the folder you created for the course, just like you have been doing for
69+
the exercise repositories. This will help ensure that you are programming in
70+
the same environment you have been using all along, and therefore avoid any
71+
unfortunate misconfiguration surprises in the test.
72+
73+
This is a test of programming as a whole, so using Git correctly is a part of
74+
the test. This has some consequences for how you should go about the test:
75+
76+
1. Commit *and* push your work as you go along. Do not rely on committing once
77+
at the end of the test. You will be marked on what you have pushed to GitHub
78+
at the end of the test period. If the first time that you try to push
79+
something to GitHub is at the end of the test time, and something goes wrong, then
80+
you will receive 0% for the test, because you will not have pushed any
81+
answers.
82+
2. Don't forget to `git add` any files you need to create. If you don't add them
83+
to the repository, they won't be pushed and therefore they won't be marked.
84+
85+
.. warning::
86+
87+
If you commit and push often as you go through the test then not only will
88+
you know that you have some marks in the bank already, but you will have a
89+
record of what you had done at each point in time. In the unlikely event of a failure outside your
90+
control, such as your network failing or GitHub going down, it will be very
91+
easy to assign the correct marks to students who have already pushed a large
92+
part of their work to GitHub. At the other extreme, it will be difficult to
93+
ascribe any credit at all to students with no pushed work who then push a
94+
single commit to GitHub after the time has expired.
9895

9996
Preparing for the test
10097
----------------------
@@ -121,7 +118,7 @@ Exercises
121118
.. proof:exercise::
122119
123120
Obtain the `practice problem from GitHub Classroom
124-
<https://classroom.github.com/a/whZ5Hmzx>`__. Follow the instructions in
121+
<https://classroom.github.com/a/N9g4rTii>`__. Follow the instructions in
125122
the README file that will be displayed on GitHub on your copy of the page.
126123

127124
Note that these instructions are only applicable to the practice problems.
@@ -130,7 +127,7 @@ Exercises
130127
.. proof:exercise::
131128
132129
Obtain the `practice problem from GitHub Classroom
133-
<https://classroom.github.com/a/BIoMj_-E>`__. Follow the instructions in
130+
<https://classroom.github.com/a/inNEPHVo>`__. Follow the instructions in
134131
the README file that will be displayed on GitHub on your copy of the page.
135132

136133
Note that these instructions are only applicable to the practice problems.
@@ -139,7 +136,7 @@ Exercises
139136
.. proof:exercise::
140137
141138
Obtain the `practice problem from GitHub Classroom
142-
<https://classroom.github.com/a/jVHNwYHx>`__. Follow the instructions in
139+
<https://classroom.github.com/a/OIuwA4kx>`__. Follow the instructions in
143140
the README file that will be displayed on GitHub on your copy of the page.
144141

145142
Note that these instructions are only applicable to the practice problems.
@@ -148,7 +145,7 @@ Exercises
148145
.. proof:exercise::
149146
150147
Obtain the `practice problem from GitHub Classroom
151-
<https://classroom.github.com/a/6bPHF9F7>`__. Follow the instructions in
148+
<https://classroom.github.com/a/xiJiYtY5>`__. Follow the instructions in
152149
the README file that will be displayed on GitHub on your copy of the page.
153150

154151
Note that these instructions are only applicable to the practice problems.

0 commit comments

Comments
 (0)