python_oop#

  • Series: lecture-python-programming

  • File: lectures/python_oop.md

  • Audit date: 2026-08-26

  • Corpus snapshot: ceec881028

  • Categories audited: writing, math, code, figures, links, admonitions (JAX out of scope)

  • Overall score: 8.1 / 10

  • Priority: HIGH

Score breakdown#

Category

Score

One-line note

Writing

3/10

qe-writing-006 ×8; qe-writing-005 ×7; qe-writing-004 ×4, +3 more.

Math

10/10

no mechanical violations detected.

Code

7.5/10

qe-code-001 ×9.

JAX

out of scope

JAX rules target lecture-jax.

Figures

8/10

qe-fig-005 ×4; qe-fig-008 ×1; qe-fig-001 ×1.

References

N/A

no citations in this lecture.

Links

10/10

no mechanical violations detected.

Admonitions

10/10

no mechanical violations detected.

Issues#

Critical#

None found.

High severity#

  • [qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 9. Lines: 157, 163, 179, 344, 417, 506, 523, 614, 626. Example: the code is the least PEP8-compliant in the series, and it is the code a reader copies. No space after the comma or around the operator in def earn(w,y): ... return w+y (157-159) and def spend(w,x) (161); new_wealth = w -x, spaced on one side only (163); the whole usage block written without spaces around = or after commas - w0=100, w1=earn(w0,10), print("w0,w1,w2,w3,w4 = ", w0,w1,w2,w3,w4) (179-184); a 5-space method body in the re-displayed earn (344-345); self.k =  self.h() with a double space after = (417, and the same in return  (self.ad ...) at 497 and 501); integrand = lambda x: ... bound to a name instead of a def (506, 513); (1 / self.bd)* x missing the space before * (523); a 2-space class body and 6-space method bodies in Chaos (614-634); and self.x =  self.r * self.x *(1 - self.x), both faults on one line (626).

  • [qe-writing-005] (reviewer) — Use bold for definitions, italic for emphasis. Count: 7. Lines: 80, 90, 94, 101, 106, 187, 241. Example: the lecture bolds class definitions (51) and steady state (377) and italicises everything else it defines, including the same term twice over: ‘A class definition is a blueprint’ (94) contradicts the bold at 51; ‘hence called a method’ (90); ‘An object or instance is a realization of the class’ (101); ‘collectively referred to as attributes’ (106); ‘A Class bundles a set of data tied to a particular instance’ (187); ‘The __init__ method is a constructor method’ (241). At 80 the reverse happens - bundled together is bolded for emphasis, where the rule asks for italics.

  • [qe-writing-006] — Capitalize lecture titles properly. Count: 8. Lines: 64, 75, 126, 146, 199, 353, 460, 695. Example: H2 Title Case: ‘OOP Review’ (Review).

  • [qe-writing-008] — Remove excessive whitespace between words. Count: 16. Lines: 101, 132, 170, 172, 189, 195, 247, 266, 279, 301, …. Example: 2 spaces.

Medium severity#

  • [qe-fig-005] — Descriptive figure names for cross-referencing. Count: 4. Lines: 439, 549, 646, 660. Example: code-cell figure without mystnb figure metadata.

  • [qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 3. Lines: 154, 189, 195. Example: ‘Before we do so, in order to indicate some of the power of Classes, we’ll define two functions that we’ll call earn and spend’ (154) spends 23 words on a lead-in; ‘an instance will be the name of particular person whose instance data consist solely of its wealth’ (189) is missing an article and does not agree in number; and ‘Taken together, the instance data and functions are called attributes’ (195) redefines a term the lecture already defined 89 lines earlier at 106, in the same words and the same italics.

  • [qe-writing-003] (reviewer) — Maintain logical flow. Count: 2. Lines: 193, 239. Example: the prose asserts a link between the standalone functions and the class that the code does not have. ‘In our example, two functions earn and spend can be applied to the current instance data’ (193) and ‘The earn and spend methods deploy the functions we described earlier’ (239) both describe the Consumer class at 211-229 as using the earn/spend defined at 156-168, but the methods reimplement the arithmetic inline (self.wealth += y) and never call them. A reader who takes 239 at face value goes looking for a call that is not there.

  • [qe-writing-004] — Avoid unnecessary capitalization in narrative text. Count: 4. Lines: 154, 209, 297, 765. Example: mid-sentence ‘Classes’.

Low severity#

  • [qe-fig-001] — Do not set figure size unless necessary. Count: 1. Lines: 444. Example: figsize=.

  • [qe-fig-008] — Use lw=2 for line charts. Count: 1. Lines: 447. Example: plot() without lw=.

Strengths#

  • The Solow class ties code to mathematics: the law of motion is a labelled equation (363-367) and each method is then described by {eq} reference to it (384, 385), so h and update are not just names.

  • Instance state is demonstrated rather than asserted - c1.__dict__ and c2.__dict__ are printed side by side (281-287), and Consumer.__dict__ shows where the methods actually live (317-319).

  • The self mechanics are explained by exhibiting the equivalence of c1.earn(10) and Consumer.earn(c1, 10) (331-338) rather than by analogy.

  • The bifurcation diagram (660-673) is followed by four paragraphs that read it for the reader (675-693), ending on the observation that no value of \(r\) gives a three-cycle.

  • The indicator in the ECDF exercise is explained in the sentence immediately after the equation (762-763) - exactly what qe-math-008 asks for - and \(F_n\), \(F\) keep the uppercase-for-CDF convention of proposed qe-math-015 (proposed).