1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
3.5 KiB
3.5 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| python-tuples-update | Python Tuples Update | Programming_Language | draft | conceptual |
|
B | 0.9 | 2026-07-04 | 2026-07-04 |
|
|
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 thistupleremoves 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):
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).