概念拆解與最小重現
獨立掌握檢查 — 評量作業期間不得使用 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.