python_advanced_features#
Series: lecture-python-programming
File:
lectures/python_advanced_features.mdAudit date: 2026-08-26
Corpus snapshot:
ceec881028Categories audited: writing, code, figures, links, admonitions (JAX out of scope)
Overall score: 8.4 / 10
Priority: LOW
Score breakdown#
Category |
Score |
One-line note |
|---|---|---|
Writing |
4.5/10 |
|
Math |
N/A |
no mathematical content. |
Code |
8.5/10 |
|
JAX |
out of scope |
JAX rules target |
Figures |
9/10 |
|
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#
None found.
Medium severity#
[qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 3. Lines: 361, 374, 417. Example: trailing whitespace at the ends of the
legend_kargsdict lines (361, 362, 364) and a whitespace-only line inside theforbody (374); andkargsthroughout (line_kargs,legend_kargsat 360-361, then**kargsat 417, 440, 443, 458, 460) where every Python codebase - including the matplotlib signature the lecture quotes four lines earlier,Axes.plot(*args, ..., **kwargs)at 412 - writeskwargs.[qe-writing-001] — Use one sentence per paragraph. Count: 2. Lines: 473, 477. Example: 2 sentences in one paragraph.
[qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 3. Lines: 298, 458, 952. Example: ‘When we operate on a list of parameters, we often need to extract the content of the list as individual arguments instead of a collection when passing them into functions’ (298) is a 30-word opening for a section whose point is one clause long; the two-sentence summary at 458-460 restates the summary already given at 399-401 in the same shape (‘The difference is that … will unpack … into positional arguments, while …’), so the reader is summarised at twice; and ‘The function
sum()callsnext()to get the items, adds successive terms’ (952) has lost its conjunction.[qe-writing-003] (reviewer) — Maintain logical flow. Count: 2. Lines: 1107, 1173. Example: ‘### Advantages of iterators’ (1107-1163) answers a question raised 800 lines earlier in ‘## Iterables and iterators’ (34-287) but sits as the last subsection of ‘## Generators’, with nothing at either end connecting the two - and its closing summary is about iterables (1160-1163), not generators. And exercise paf_ex1 (1173) tells the reader to fetch
test_table.csvfrom GitHub ‘which we assume that you’ve put in your current working directory’, although the cell at 107-119 wrote that exact file to the working directory earlier in the same lecture.[qe-writing-005] (reviewer) — Use bold for definitions, italic for emphasis. Count: 4. Lines: 53, 784, 837, 906. Example: ‘## Type hints’ bolds its own definition - ‘Python supports optional type hints’ (471) - and every other section italicises instead: ‘Formally, an iterator is an object with a
__next__method’ (53), ‘this issue is solved using descriptors’ (784), ‘The objectsmilesandkmsare properties, a common kind of descriptor’ (837) and ‘The easiest way to build generators is using generator expressions’ (906). The lecture’s other italics are all doing emphasis correctly (25, 529, 1021, 1087), which makes the four definitional ones read as the same thing.[qe-writing-008] — Remove excessive whitespace between words. Count: 2. Lines: 140, 1122. Example: 2 spaces.
Low severity#
[qe-fig-005] — Descriptive figure names for cross-referencing. Count: 1. Lines: 345. Example: code-cell figure without mystnb figure metadata.
Strengths#
The Overview tells the reader to skip the lecture on a first pass and says exactly what it is for (25-31), which is the right framing for a reference chapter.
Failure is demonstrated rather than described: six cells carry
tags: [raises-exception](193, 226, 237, 282, 1005, 1070), so theStopIterationandTypeErrorappear in the rendered page instead of being promised.The decorator section builds in four stages - duplicated
assertlines (619-631), a manual wrapper (646-664), a line-by-line reading off = check_nonneg(f)(668-679), then the@form (715-723) - and then answers why the syntax exists (727-734) rather than only what it does.The
Carclass is shown three times (751-759, 794-817, 864-888) so the problem, the getter/setter fix and the decorator form sit side by side.Re-displaying the generator body with a pointing comment -
# This line!(1026) and# execution continues from here(1093) - marks the resume point without needing a diagram.
Recommended actions#
Fix
iterator.___next___()at 151 - three underscores on each side, in the one line that spells out how theforloop calls__next__.Correct the memory claim at 1122:
range(n)is lazy in Python 3, sodrawsis the only huge list here; and support ‘very slow’ (1124) with aqe.Timercomparison rather than asserting it.Rename
kargstokwargsthroughout (360, 361, 417, 440, 443, 458, 460) to match the matplotlib signature quoted at 412.Reconcile exercise paf_ex1 (1173) with the lecture - the reader already has
test_table.csvfrom the cell at 107-119, so the download instruction and the ‘we assume’ hedge can go.Bold the definitions at 53, 784, 837 and 906, keeping italics for the emphasis they are already doing well at 25, 529, 1021 and 1087.
Cut the repetition between the two summaries (399-401 and 458-460), trim the 30-word opening at 298, and restore the conjunction at 952.
Housekeeping: split the two-sentence paragraphs at 473 and 477 (qe-writing-001), remove the double spaces at 140 and 1122 (qe-writing-008), close the space before the period at 55, 102 and 608, clear the trailing and blank-line whitespace at 361-364 and 374, and add mystnb caption/name metadata to the plot cell at 345 (qe-fig-005).