概念分解与最小复现
独立掌握检查 — 评估作业期间不得使用 AI 辅助。如接受任何辅助必须如实申报,但接受辅助的作业只计为补救练习:在声称掌握之前,必须完成一次新的无辅助检查。
前置要求
完成第 01 学习日(对象变更追踪器与预测-实验-复盘流程)。无需高级 Python 知识。
学习目标
把一个令人困惑的请求分解为可观察的概念、输入、输出、约束和最小复现;复用第 01 学习日的追踪推理方法,而不是照抄其代码。
操作指引
把第 01 学习日的预测-实验-复盘循环应用到一个新问题上——不要粘贴第 01 学习日的追踪器,也不要自行编造任务。全程不查资料:(1) 在运行之前写下所有预测输出;(2) 运行给定代码片段并记录实际输出;(3) 把结果分解为输入、预期输出、约束、名称/对象/原地修改/新对象分配;(4) 提炼出最小复现;(5) 安排一次新的无辅助检查。请控制在 120 分钟预算内。
自主演练与记录
一位学习者报告:"我的清理辅助函数本应去掉空格,但运行后变量里的空格还在。为什么 s.strip() 没能修好 s?"
运行前先预测每一行输出:
s = ' data '
print(repr(s.strip()))
print(repr(s))
s = s.strip()
print(repr(s))
然后把这个请求分解为:输入;学习者预期的输出;实际观察到的输出;被破坏的约束;以及哪些要素是名称、对象、原地修改和新对象分配。最后写出仍能复现该效果的最小代码片段(你的 MRE)。
对 s.strip() 问两个问题:它是修改现有字符串对象,还是分配并返回一个新对象?方法调用在没有赋值的情况下会改变名称 s 的指向吗?对照第 01 学习日中修改了共享对象的 list.append。
分解参考解答:
1. 观察到的输出(已验证):
'data' — s.strip() 分配并返回一个去掉空格的新字符串
' data ' — s 仍引用原对象;没有任何重新绑定
'data' — 只有在 s = s.strip() 之后,名称才引用新对象
2. 输入:s = ' data ',以及"调用 s.strip() 会改变 s"这一预期。
3. 预期的(错误)输出:第二行打印 'data' — 学习者以为是原地修改。
4. 被破坏的约束:字符串是不可变的;strip() 无法改变 s 所引用的对象。仅有方法调用不会重新绑定名称——只有赋值(s = ...)才会。
5. 名称/对象/原地修改/新对象分配:s 是绑定到一个字符串对象的名称;strip() 分配一个新的字符串对象;整个过程没有发生原地修改;原对象保持不变,只有在重新绑定后才不可达。对照第 01 学习日:list.append 修改了共享对象,因此 b 和 a 都能看到变化。
6. 最小复现(核心三行):
s = ' data '
s.strip()
print(repr(s)) # ' data ' — 返回值被丢弃,名称未变7. 已安排的新检查:两天后无辅助预测
name.upper() 与 name = name.upper() 的区别。
在无辅助、不查资料的条件下满足以下全部即通过:(a) 运行前正确预测全部三行输出;(b) 分解正确指出"是分配新对象而非原地修改"以及"只有赋值才重新绑定名称";(c) MRE 不超过三行且仍能复现变量不变的效果。任何辅助只计为补救练习,在声称掌握之前必须先无辅助正确预测并验证一个新变体(如 `name.upper()`)。
权威源资源与权利证明
Python Data Model & Mutability Reference
对应章节 / 时间戳: Section 3.1 & 3.2 (Objects, values, types)
验证版本与日期: Python 3.12 (Verified: 2026-10-30)
Normative reference on Python identity vs value semantics and mutable vs immutable types without tutorial inaccuracies.
Basic command line and high school reading comprehension
Official documentation is mirrored locally via standard library pydoc and embedded offline lesson explanations if internet access is interrupted.
对比候选资源与选型分析 (4)
High pedagogical clarity for Python fundamentals, but structures mutability around academic lecture pacing rather than immediate hands-on minimal reproductions (MRE).
Strong systems engineering and PyTorch tensor rigor, but assumes advanced Python mastery and PyTorch installed; deferred to Days 30-60 model pretraining.
Strong visual intuition for linear transformations and vector spaces; selected for Days 10-18 mathematics foundations, but not relevant for Day 01 Python object references.
Clear, executable autograd intuition; code is MIT license, but video subtitles have unknown/proprietary distribution rights (prohibiting full-text transcript import). Selected for Days 19-25 autograd implementation with linking-only reuse.
Improving Students' Learning With Effective Learning Techniques: Promising Directions From Cognitive and Educational Psychology
对应章节 / 时间戳: Psychological Science in the Public Interest 14(1): 4-58; practice testing and distributed practice sections
验证版本与日期: Psychological Science in the Public Interest, 2013 (Verified: 2026-10-30)
Detailed comparative review rating practice testing and distributed practice as high-utility techniques while rating highlighting and rereading low-utility; anchors the retrieval, correction, and spaced-review design of Days 88-90.
None beyond general academic reading.
Curriculum restates the utility ratings and application conditions in original prose; every task remains runnable offline.
对比候选资源与选型分析 (2)
Important negative result on learning-styles matching but narrower scope; Dunlosky et al. rates a broader set of techniques directly usable for this curriculum.
Strong trade-book synthesis of the same evidence base; the peer-reviewed review is preferred for citation precision and technique-by-technique utility ratings.