Skip to content

Commit 2582171

Browse files
committed
Website build
1 parent 295833f commit 2582171

33 files changed

+206
-269
lines changed

10_further_object-oriented_features.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ <h1><span class="section-number">10. </span>Further object-oriented features<a c
7575
<summary>
7676
Video: decorators.</summary><div class="video_wrapper" style="">
7777
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/526946976" style="border: 0; height: 345px; width: 560px">
78-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=f1d61410-4200-42e5-92c4-acf2011de8ab">watch this video on Panopto</a>.</p>
78+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=75d2f2a5-5ab9-464b-8eee-ae1c00dbf366">watch this video on Panopto</a>.</p>
7979
</details><p>In <a class="reference internal" href="9_trees_and_directed_acyclic_graphs.html#trees"><span class="std std-numref">Chapter 9</span></a> we encountered the
8080
<a class="reference external" href="https://docs.python.org/3/library/functools.html#functools.singledispatch" title="(in Python v3.11)"><code class="xref py py-func docutils literal notranslate"><span class="pre">functools.singledispatch()</span></code></a> decorator, which turns a function into a
8181
<a class="reference internal" href="9_trees_and_directed_acyclic_graphs.html#term-single-dispatch-function"><span class="xref std std-term">single dispatch function</span></a>. More generally, a decorator is a function
@@ -235,7 +235,7 @@ <h3><span class="section-number">10.1.3. </span>The <a class="reference external
235235
<summary>
236236
Video: Abstract base classes.</summary><div class="video_wrapper" style="">
237237
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/526947635" style="border: 0; height: 345px; width: 560px">
238-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=f4678a69-731c-45fe-bdbf-acf2011de880">watch this video on Panopto</a>.</p>
238+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9a9b872a-9499-40b7-a228-ae1c00dbf947">watch this video on Panopto</a>.</p>
239239
</details><p>We have now on several occasions encountered classes which are not designed to
240240
be instantiated themselves, but merely serve as parent classes to concrete
241241
classes which are intended to be instantiated. Examples of these classes
@@ -394,7 +394,7 @@ <h3><span class="section-number">10.2.4. </span>Virtual subclasses<a class="head
394394
<summary>
395395
Video: virtual subclasses.</summary><div class="video_wrapper" style="">
396396
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/526947427" style="border: 0; height: 345px; width: 560px">
397-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=4114bb1d-cc31-4cfc-81a6-acf2011de8d6">watch this video on Panopto</a>.</p>
397+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=fd48b1c1-8e81-4c6d-8415-ae1c00dc07eb">watch this video on Panopto</a>.</p>
398398
</details><p>We learned in <a class="reference internal" href="3_objects.html#objects"><span class="std std-numref">Chapter 3</span></a> that we can determine if a type is a
399399
number by checking if it is an instance of <a class="reference external" href="https://docs.python.org/3/library/numbers.html#numbers.Number" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">numbers.Number</span></code></a>. This is a
400400
slightly different usage of abstract base classes. Rather than providing part

1_introduction.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ <h3><span class="section-number">1.1.1. </span>Python versions<a class="headerli
159159
<summary>
160160
Video: setting up your virtual environment.</summary><div class="video_wrapper" style="">
161161
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/486546635" style="border: 0; height: 345px; width: 560px">
162-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=011d73de-d93c-4dc8-8996-ac8501521b33">watch this video on Panopto</a></p>
162+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=d63e1c6e-18ff-48de-af03-ae1c00da3b3f">watch this video on Panopto</a></p>
163163
</details><p>In the course of the exercises, You’re going to create, edit, and install a
164164
whole bunch of Python packages. It’s highly desirable have a predictable
165165
programming environment in which the experiments you’re doing don’t interfere
@@ -298,7 +298,7 @@ <h3><span class="section-number">1.2.2. </span>Creating the venv<a class="header
298298
<h2><span class="section-number">1.3. </span>Installing Python packages<a class="headerlink" href="#installing-python-packages" title="Permalink to this headline"></a></h2>
299299
<p>Suppose we’ve created and activated a venv, and now there’s a Python package
300300
we’d like to have access to. Installation of Python packages is handled by the
301-
Python package <a class="reference external" href="https://pip.pypa.io/en/stable/" title="(in pip v22.3)"><span class="xref std std-doc">Pip</span></a>, which you will usually find
301+
Python package <a class="reference external" href="https://pip.pypa.io/en/stable/" title="(in pip v23.0)"><span class="xref std std-doc">Pip</span></a>, which you will usually find
302302
pre-installed in your Python installation. Pip has many usage options, which
303303
enable a large number of different installation configurations. However, for
304304
most users most of the time, a few simple pip commands suffice. As with

2_programs_in_files.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ <h2><span class="section-number">2.1. </span>The Python interpreter<a class="hea
8484
<summary>
8585
Video: a first Python script.</summary><div class="video_wrapper" style="">
8686
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/486557682" style="border: 0; height: 345px; width: 560px">
87-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=0f9a50a0-59b4-4bdf-ab90-ac850154fafb">watch this video on Panopto</a></p>
87+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=8773e5b7-a331-4ca3-a59d-ae1c00da3b4f">watch this video on Panopto</a></p>
8888
</details><p>Before we dive into the various different ways that Python code can be
8989
organised and run, it’s helpful to have a mental model of what it actually
9090
means for Python code to execute. Python is an interpreted language. This means
@@ -126,6 +126,13 @@ <h3><span class="section-number">2.1.1. </span>IPython<a class="headerlink" href
126126
</pre></div>
127127
</div>
128128
<p>This will result in output similar to the following:</p>
129+
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="go">Python 3.11.0 (main, Oct 25 2022, 14:13:24) [Clang 14.0.0 (clang-1400.0.29.202)]</span>
130+
<span class="go">Type &#39;copyright&#39;, &#39;credits&#39; or &#39;license&#39; for more information</span>
131+
<span class="go">IPython 8.6.0 -- An enhanced Interactive Python. Type &#39;?&#39; for help.</span>
132+
133+
<span class="gp">In [1]:</span>
134+
</pre></div>
135+
</div>
129136
<p>Just as in a Jupyter notebook, this last line is the Python prompt at which
130137
you can type any Python you like. If you press return after a complete Python
131138
statement, the statement will execute immediately. Unlike in a Jupyter
@@ -266,7 +273,7 @@ <h3><span class="section-number">2.2.3. </span>When not to use scripts<a class="
266273
<summary>
267274
Video: a first Python module.</summary><div class="video_wrapper" style="">
268275
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/486845755" style="border: 0; height: 345px; width: 560px">
269-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=972f92c6-6b55-4510-9c2c-ac8600fca11a">watch this video on Panopto</a></p>
276+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=2f0cb956-9e78-4022-94ff-ae1c00da3b41">watch this video on Panopto</a></p>
270277
</details><p>A module is, like a script, a plain text file containing Python
271278
code. Modules must have names ending in <code class="file docutils literal notranslate"><span class="pre">.py</span></code>. So far, that’s
272279
identical to a script. Indeed, it’s sometimes possible (though not
@@ -403,7 +410,7 @@ <h2><span class="section-number">2.4. </span>Packages<a class="headerlink" href=
403410
<summary>
404411
Video: a first Python package.</summary><div class="video_wrapper" style="">
405412
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/487003753" style="border: 0; height: 345px; width: 560px">
406-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=c4b0aedd-02a8-45d1-946b-ac86015b6d0b">watch this video on Panopto</a></p>
413+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=a1a9c7ab-147b-491d-b3dc-ae1c00da3b3f">watch this video on Panopto</a></p>
407414
</details><p>Modules are the principal mechanism for storing code which is intended
408415
to be used by other code. However, putting all of the code for a
409416
complex area of mathematics in a single huge Python file is not a
@@ -660,7 +667,7 @@ <h2><span class="section-number">2.5. </span>Testing frameworks<a class="headerl
660667
<summary>
661668
Video: introducing Pytest.</summary><div class="video_wrapper" style="">
662669
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/486987209" style="border: 0; height: 345px; width: 560px">
663-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=c636383d-6125-4a7c-bad7-ac86015b6d4c">watch this video on Panopto</a></p>
670+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=73421f63-998c-4273-9c41-ae1c00da4624">watch this video on Panopto</a></p>
664671
</details><p>Attempting to establish whether a program correctly implements the intended
665672
algorithm is core to effective programming, and programmers often spend more
666673
time correcting bugs than writing new code. We will turn to the question of how
@@ -669,7 +676,7 @@ <h2><span class="section-number">2.5. </span>Testing frameworks<a class="headerl
669676
including tests in your code here.</p>
670677
<p>There are a number of Python packages which support code testing. The concepts
671678
are largely similar so rather than get bogged down in the details of multiple
672-
frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v0.1.dev435+g3ad4344)"><span class="xref std std-doc">Pytest</span></a>, which is one of the
679+
frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v7.4.0.dev8+g22524046c)"><span class="xref std std-doc">Pytest</span></a>, which is one of the
673680
most widely used. Pytest is simply a Python package, so you can install it into
674681
your current environment using:</p>
675682
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(PoP_venv)</span> <span class="gp">$ </span>python -m pip install pytest

3_objects.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ <h2><span class="section-number">3.3. </span>Defining new types<a class="headerl
228228
<summary>
229229
Video: a first class</summary><div class="video_wrapper" style="">
230230
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/488143930" style="border: 0; height: 345px; width: 560px">
231-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=f8b07554-16ea-47b8-bf19-ac8a010af0f6">watch this video on Panopto</a></p>
231+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=b70b944d-612c-4e57-9538-af8d01031342">watch this video on Panopto</a></p>
232232
</details><p>Python has a rich set of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html" title="(in Python v3.11)"><span class="xref std std-doc">built-in types</span></a>. These form powerful building blocks for the
233233
language, but one very soon finds mathematical abstractions which do
234234
not have implementations among the built-in types of the Python
@@ -351,7 +351,7 @@ <h3><span class="section-number">3.3.3. </span>Methods<a class="headerlink" href
351351
<summary>
352352
Video: defining methods</summary><div class="video_wrapper" style="">
353353
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/488273256" style="border: 0; height: 345px; width: 560px">
354-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=613249ca-71b8-4f3b-8db9-ac8a0166aa42">watch this video on Panopto</a></p>
354+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=b3a56e5f-2ed4-4417-aaf8-ae1c00da6017">watch this video on Panopto</a></p>
355355
</details><p>We have already met the <a class="reference internal" href="#term-special-method"><span class="xref std std-term">special method</span></a> <a class="reference external" href="https://docs.python.org/3/reference/datamodel.html#object.__init__" title="(in Python v3.11)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code></a>,
356356
which defines the class constructor. A much more typical case is an
357357
ordinary method, without a special underscore name. For example,
@@ -401,7 +401,7 @@ <h3><span class="section-number">3.3.4. </span>String representations of objects
401401
<summary>
402402
Video: printing classes</summary><div class="video_wrapper" style="">
403403
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/488275072" style="border: 0; height: 345px; width: 560px">
404-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=b30db20c-1224-41b7-a5f2-ac8a01680608">watch this video on Panopto</a></p>
404+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=4fe0252a-619d-4959-99f0-ae1c00da657d">watch this video on Panopto</a></p>
405405
</details><p>Remember that a key reason for defining new classes is to enable users
406406
to reason about the resulting objects at a higher mathematical level. An
407407
important aid to the user in doing this is to be able to look at the
@@ -496,7 +496,7 @@ <h3><span class="section-number">3.3.4. </span>String representations of objects
496496
<summary>
497497
Video: object equality and test driven development</summary><div class="video_wrapper" style="">
498498
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/488981397" style="border: 0; height: 345px; width: 560px">
499-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=821e53ec-d2c8-43a6-bb16-ac8c01045f31">watch this video on Panopto</a></p>
499+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=17aa405c-bf70-4007-b365-ae1c00da7976">watch this video on Panopto</a></p>
500500
</details><p>When are two objects equal? For built-in types Python has equality rules which
501501
broadly match the mathematical identities that you might expect. For example,
502502
two numbers of different types are equal if their numerical value is equal:</p>
@@ -576,7 +576,7 @@ <h3><span class="section-number">3.3.4. </span>String representations of objects
576576
<summary>
577577
Video: polynomial addition.</summary><div class="video_wrapper" style="">
578578
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/489009900" style="border: 0; height: 345px; width: 560px">
579-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=727c5b9a-bf61-480e-912e-ac8c01045f09">watch this video on Panopto</a></p>
579+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=d9a38b7e-d182-46f6-90fc-ae1c00da8682">watch this video on Panopto</a></p>
580580
</details><p>It’s all very well to be able to compare our polynomial objects, but
581581
we won’t really have captured the mathematical abstraction involved
582582
unless we have at least some mathematical operations. We have already

4_style.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<summary>
7272
Video: why style?</summary><div class="video_wrapper" style="">
7373
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/499766703" style="border: 0; height: 345px; width: 560px">
74-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=3572d8ea-5635-4b1a-9243-acae0150ddf8">watch this video on Panopto</a></p>
74+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=81bda525-60bb-46a7-bdc9-ae1c00da8a74">watch this video on Panopto</a></p>
7575
</details><section id="the-value-of-convention">
7676
<h2><span class="section-number">4.1. </span>The value of convention<a class="headerlink" href="#the-value-of-convention" title="Permalink to this headline"></a></h2>
7777
<p>Consider the following definition of the limit of a function <span class="math notranslate nohighlight">\(f\)</span> at a
@@ -158,7 +158,7 @@ <h3><span class="section-number">4.2.1. </span>Linters<a class="headerlink" href
158158
<summary>
159159
Video: installing and using a linter.</summary><div class="video_wrapper" style="">
160160
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/499770130" style="border: 0; height: 345px; width: 560px">
161-
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=91c271e4-a61f-493c-a725-acae015273d5">watch this video on Panopto</a></p>
161+
</iframe></div><p>Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=63c09ddd-ec18-4746-b1b9-ae1c00da9680">watch this video on Panopto</a></p>
162162
</details><p>One of the helpful characteristics of PEP 8 is that many of its strictures can
163163
be enforced automatically by a computer program. Programs that automatically
164164
check programming style are called linters. Lint are the little fibres that tend
@@ -238,7 +238,7 @@ <h3><span class="section-number">4.2.4. </span>Configuring Flake8<a class="heade
238238
errors. However, it’s also likely to be the case that there are some rules that
239239
you just don’t want to apply across your whole project. This configuration can
240240
be achieved in the file <code class="file docutils literal notranslate"><span class="pre">setup.cfg</span></code>, which lives in the top of your
241-
Git repository alongside <code class="file docutils literal notranslate"><span class="pre">setup.py</span></code>. <code class="file docutils literal notranslate"><span class="pre">setup.cfg</span></code> can be
241+
Git repository alongside <code class="file docutils literal notranslate"><span class="pre">pyproject.toml</span></code>. <code class="file docutils literal notranslate"><span class="pre">setup.cfg</span></code> can be
242242
used to configure a lot of different Python tools, so it stores different
243243
configurations in different sections. <a class="reference internal" href="#flake8conf"><span class="std std-numref">Listing 4.1</span></a> shows an example
244244
Flake8 section. The full list of available options is presented in the <a class="reference external" href="https://flake8.pycqa.org">Flake8

0 commit comments

Comments
 (0)