--- id: python-pass-statement title: "Python Pass Statement" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["pass keyword", "파이썬 pass λ¬Έ"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["python", "programming", "w3schools", "pass"] raw_sources: ["https://www.w3schools.com/python/python_if_pass.asp"] applied_in: [] github_commit: "" --- # [[Python Pass Statement]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Python cannot have a truly empty code block β€” a comment alone raises an IndentationError β€” so `pass` exists as an actual (no-op) statement that satisfies the syntax requirement while doing nothing. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`pass`** β€” a null operation; nothing happens when it executes; a placeholder. [S1] - **Why needed** β€” if/for/function/class blocks cannot be syntactically empty in Python. [S1] - **Common uses** β€” sketching structure before implementing logic, satisfying syntax when no action is needed, placeholders during development, empty functions/classes planned for later. [S1] - **`pass` vs. comments** β€” a comment is ignored entirely by Python and does NOT satisfy the "block needs a statement" requirement; `pass` does. [S1] - **Works in other contexts too** β€” loops, functions, classes, not just if statements. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Comment-only block is a common beginner error** β€” `if score > 90: # comment` with no actual statement raises `IndentationError`, since comments aren't statements β€” `pass` is the fix. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic pass: `if b > a: pass`. [S1] - Comment-only block fails: `if score > 90: # This is excellent` alone raises IndentationError. [S1] - Fixed with pass: `if score > 90: pass # This is excellent`. [S1] - In a function stub: `def calculate_discount(price): pass # TODO: Implement discount logic`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” ν•¨μˆ˜/클래슀의 μŠ€ν…(stub) κ΅¬ν˜„μ— ν‘œμ€€μ μœΌλ‘œ μ“°μ΄λŠ” νŒ¨ν„΄μ΄λ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) pass as a function stub placeholder (Python): ```python def calculate_discount(price): pass # TODO: Implement discount logic ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Python Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Python If Statement]], [[Python For Loops]], [[Python Functions]] - **μ°Έμ‘° λ§₯락:** 빈 블둝이 ν•„μš”ν•œ λͺ¨λ“  κ³³(if/for/ν•¨μˆ˜/클래슀)μ—μ„œ μž¬μ‚¬μš©λ˜λŠ” ν”Œλ ˆμ΄μŠ€ν™€λ”. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Python Pass Statement β€” https://www.w3schools.com/python/python_if_pass.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Python Pass Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).