Ch 30 / 20.python.list-reference.ipynb — Python side complete, C++ bridge missing
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Domain
- content, documentation
Research direction
Open 30.pointers-and-memory-management/20.python.list-reference.ipynb and run the existing Python examples, focusing on the predict-before-run prompts in cells 12 and 17 and the exercise in cell 24. Add the C++ bridge around cell 22, including the requested raw-pointer and vector examples, analogy table, copy terminology, and a final prediction exercise. Done means the notebook connects the Python observations to both C++ cases before the existing exercise.
Written by the indexing model from the issue text.
Description
The notebook 30.pointers-and-memory-management/20.python.list-reference.ipynb sets up an excellent pedagogical hook: the Python [one_row] * n_row aliasing pattern (where one inner list gets referenced 10 times) is exactly the right entry point for introducing reference semantics in a language students already know. The predict-before-run prompts in cells 12 and 17 ("What do you think happened?" / "Why the result is different this time?") are pedagogically strong.
However, the notebook stops at the exercise prompt (cell 24):
"Write two C/C++ programs that respectively regenerate python results above."
without providing the C++ side of the bridge. Students are left to make the cross-language connection on their own — exactly the connection the notebook's title (python.list-reference) and structure promise to deliver.
Suggested addition (~3-4 hours of work)
Add a new section after the Python observations (around cell 22, before the exercise) that:
-
Writes the equivalent C++ programs — one with raw
int**showing the aliasing bug parallel; one withstd::vector<std::vector<double>>showing the safe modern equivalent. -
Translates the
is/id()mental model to C++ —Python a is bcorresponds toC++ &a == &bfor the aliasing case. Show this withcout << &matrix[0] << " == " << &matrix[1] << '\n';parallel. -
Names the analogy explicitly with a side-by-side table:
Python C/C++ What it means b = a(list)int *b = a;Both point to same memory b = a.copy()std::vector<int> b = a;Deep copy a is b&a[0] == &b[0]Same memory? -
Connects to "shallow vs deep copy" as a named concept that bridges both languages.
-
Closes with a "predict before run" mission parallel to the Python exercises.
Why this matters
This notebook contains the single most pedagogically unique idea in the repo — using Python as the anchor for C++ pointer semantics. As-is, it's a sketch of the bridge rather than the bridge itself. Completing it would make this the most powerful piece of the Ch 30 supplement-for-freshmen role discussed in 2026-05-20 session evaluation.
Context
Tagged freshman-audience because completing this bridge is specifically what makes the chapter useful for post-Python freshmen (rather than the graduate audience the chapter was originally written for).
- Dominant language
- Jupyter Notebook
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kangwonlee/2018pycpp
-
Pointer arithmetic demo accesses out-of-bounds memory without warning (Ch 30 / 00.pointers.ipynb) Openbug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
kangwonlee/2018pycpp#75 ·
-
Intel assembly Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
kangwonlee/2018pycpp#65 ·
-
CI in tutorial git Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
kangwonlee/2018pycpp#61 ·
-
Rust study Open
Difficulty 5/5 Over a week Newbie friendliness 15/100
kangwonlee/2018pycpp#56 · 1 comment ·
-
question
Difficulty 3/5 1-2 days Newbie friendliness 25/100
kangwonlee/2018pycpp#52 ·
All issues in kangwonlee/2018pycpp
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
edit event needs review
Difficulty 1/5 Under an hour Newbie friendliness 90/100
processing/processing-community-day#268 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
digitalfabrik/integreat-cms#4574 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ubilabs/esa-climate-from-space#2555 ·
-
token request
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Uniswap/default-token-list#2587 ·