--- id: python-tuples-update title: "Python Tuples Update" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["Update Tuples", "파이썬 튜플 수정"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.9 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["python", "programming", "w3schools", "tuples", "immutable"] raw_sources: ["https://www.w3schools.com/python/python_tuples_update.asp"] applied_in: [] github_commit: "" --- # [[Python Tuples Update]] ## 🎯 한 줄 통찰 (One-line insight) Tuples have no native way to change, add, or remove items — every workaround converts to a list, mutates, and converts back, EXCEPT adding an entire tuple, which the `+=` operator supports directly. [S1] ## 🧠 핵심 개념 (Core concepts) - **Immutability** — tuples cannot be changed once created. [S1] - **Change workaround** — convert to list, modify, convert back to tuple. [S1] - **Add workaround (via list)** — convert to list, `append()`, convert back. [S1] - **Add workaround (via tuple concatenation)** — `thistuple += ("orange",)` directly adds another tuple — no list conversion needed. [S1] - **Remove workaround** — convert to list, `remove()`, convert back. [S1] - **Delete entirely** — `del thistuple` removes the variable completely (subsequent use raises an error). [S1] ## 🧩 추출된 패턴 (Extracted patterns) - **Concatenation is the one native "mutation"** — while individual item changes need the list round-trip, adding a whole new tuple via `+=` works natively because it creates a brand-new tuple object rather than mutating the existing one. [S1] ## 📖 세부 내용 (Details) - Change via list round-trip: `x = ("apple","banana","cherry"); y = list(x); y[1] = "kiwi"; x = tuple(y)`. [S1] - Add via list round-trip: `y = list(thistuple); y.append("orange"); thistuple = tuple(y)`. [S1] - Add via tuple concatenation: `y = ("orange",); thistuple += y`. [S1] - Remove via list round-trip: `y = list(thistuple); y.remove("apple"); thistuple = tuple(y)`. [S1] - Delete entirely: `del thistuple`. [S1] ## ⚖️ 모순 및 업데이트 (Contradictions & updates) 소스에서 모순되는 정보는 발견되지 않음. ## 🛠️ 적용 사례 (Applied in summary) 현재 발견된 실제 적용 사례가 없습니다 — 리스트 변환 왕복은 튜플을 "임시로 가변화"하는 표준 회피책이다. [S1] ## 💻 코드 패턴 (Code patterns) Add a single item via tuple concatenation (Python): ```python thistuple = ("apple", "banana", "cherry") y = ("orange",) # comma required for single-item tuple thistuple += y print(thistuple) ``` ## ✅ 검증 상태 및 신뢰도 - **상태:** draft - **검증 단계:** conceptual - **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body) - **신뢰 점수:** 0.90 - **중복 검사 결과:** 신규 생성 (New discovery) ## 🔗 지식 그래프 (Knowledge Graph) - **상위/루트:** [[Python Tutorial]] - **관련 개념:** [[Python Tuples]], [[Python Lists]], [[Python Tuples Join]] - **참조 맥락:** 튜플 불변성의 실무적 한계를 우회하는 표준 패턴. ## 📚 출처 (Sources) - [S1] W3Schools — Python - Update Tuples — https://www.w3schools.com/python/python_tuples_update.asp ## 📝 변경 이력 (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Python - Update Tuples" page (Astra wiki-curation, P-Reinforce v3.1 format).