概念分解と最小再現
独立習得チェック — 評価対象の作業中に AI の支援は受けられません。支援を受けた場合は誠実に申告することが必須ですが、支援を受けた作業はあくまで復習扱いです。習得を主張する前に、新しい無支援チェックを完了してください。
前提条件
デイ 01 の修了(オブジェクト変更トレーサーと予測・実験・振り返りルーチン)。高度な Python 知識は不要です。
学習目標
混乱を招く依頼を、観察可能な概念・入力・出力・制約・最小再現に分解する。デイ 01 のコードを複写するのではなく、そのトレーサー思考を再利用する。
手順
デイ 01 の予測・実験・振り返りサイクルを新しい問題に適用します。デイ 01 のトレーサーを貼り付けたり、自分で課題を新たに考案したりしないでください。閉巻で進めます。(1) 実行前にすべての予測出力を書く。(2) 提示されたスニペットを実行し、観測された出力を記録する。(3) 結果を入力・期待出力・制約・名前/オブジェクト/ミューテーション/アロケーションに分解する。(4) 最小再現を抽出する。(5) 新しい無支援チェックを1件予定する。120 分の時間内に収めてください。
演習と予測記録
ある学習者の報告:「クリーンアップ用ヘルパーで空白を取り除くはずが、実行後も変数に空白が残ったままです。なぜ s.strip() は s を直してくれないのでしょう?」
実行前に全行の出力を予測してください:
s = ' data '
print(repr(s.strip()))
print(repr(s))
s = s.strip()
print(repr(s))
次にこの依頼を、入力・学習者が期待した出力・観測された出力・破られた制約・どの要素が名前/オブジェクト/ミューテーション/アロケーションか、に分解してください。最後に、同じ効果を再現する最小のスニペット(MRE)を書いてください。
s.strip() について2つ自問してください。既存の文字列オブジェクトを変更するのか、それとも新しいオブジェクトを割り当てて返すのか。そしてメソッド呼び出しは代入なしに名前 s の参照先を変えるのか。共有オブジェクトを変更したデイ 01 の list.append と比較してください。
分解の模範解答:
1. 観測出力(検証済み):
'data' — s.strip() は空白を除いた新しい文字列を割り当てて返す
' data ' — s は依然として元のオブジェクトを参照。何も再束縛されていない
'data' — s = s.strip() の後に初めて名前が新しいオブジェクトを参照する
2. 入力:s = ' data ' と、「s.strip() を呼べば s が変わる」という期待。
3. 期待した(誤った)出力:2行目に 'data' — 学習者は変更を前提としていた。
4. 破られた制約:文字列はイミュータブルであり、strip() は s が参照するオブジェクトを変更できない。メソッド呼び出しだけでは名前は再束縛されない。再束縛するのは代入(s = ...)だけである。
5. 名前/オブジェクト/ミューテーション/アロケーション:s は1つの文字列オブジェクトに束縛された名前。strip() は新しい文字列オブジェクトを割り当てる。ミューテーションは一切発生しない。元のオブジェクトは変わらず、再束縛後に初めて到達不能になる。デイ 01 との対比:list.append は共有オブジェクトを変更したため、b と a の両方が変化を観測した。
6. 最小再現(核心の3行):
s = ' data '
s.strip()
print(repr(s)) # ' data ' — 戻り値が破棄され、名前は変わらない7. 予定した新規チェック:2日後に
name.upper() と name = name.upper() の違いを無支援で予測する。
無支援・閉巻で以下を満たした場合に合格:(a) 実行前に3行すべての出力を正しく予測した。(b) 分解が「ミューテーションではなくアロケーション」と「代入のみが名前を再束縛する」を正しく特定した。(c) MRE が3行以内で変数が変わらない効果を再現した。支援を受けた場合は復習扱いであり、習得を主張する前に新しい無支援のバリエーション(例:`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.