Section 1: Lab: เตรียมโปรเจกต์ Python 3.14 แบบมืออาชีพ
- ของใหม่ใน Python 3.14 ที่ควรรู้ และการเลือกรุ่นที่ใช้งาน
- จัดการ Python, Virtual Environment และ Dependency ด้วย uv
- โครงสร้างโปรเจกต์และไฟล์ pyproject.toml
- ตรวจและจัดรูปแบบโค้ดอัตโนมัติด้วย Ruff
- Lab: สร้างโปรเจกต์ตั้งต้นที่ใช้ต่อทั้งหลักสูตร
Section 2: Type Hints, Docstring และ Comment ที่ดี
- Type Hints สำหรับตัวแปร ฟังก์ชัน และ Collection
- Generic แบบใหม่ด้วยไวยากรณ์ [T] และ type alias
- ตรวจชนิดข้อมูลด้วย Pyright หรือ mypy
- เขียน Docstring และ Comment ที่ช่วยทีมแทนการอธิบายสิ่งที่โค้ดบอกอยู่แล้ว
- Lab: เพิ่ม Type Hints และ Docstring ให้โค้ดเดิมแล้วแก้จุดที่ตรวจพบ
Section 3: Lab: Magic Methods
- __init__, __repr__ และ __str__ ใช้ต่างกันอย่างไร
- Magic Methods สำหรับตัวดำเนินการทางคณิตศาสตร์และ Unary
- การเปรียบเทียบด้วย __eq__, __lt__ และ functools.total_ordering
- ทำให้คลาสทำงานเหมือน Collection ด้วย __len__, __getitem__ และ __iter__
- Lab: คลาส Money และ Vector ที่ใช้ตัวดำเนินการได้เหมือนชนิดข้อมูลในตัว
Section 4: Lab: Linked List ด้วยคลาสของตนเอง
- Single และ Doubly Linked List ต่างกันอย่างไร
- สร้าง Node และท่องรายการ (Traverse)
- แทรก ต่อท้าย และลบข้อมูลในตำแหน่งต่าง ๆ
- ใช้ Magic Methods ให้ Linked List วนลูปและหาความยาวได้
- เปรียบเทียบกับ list และ collections.deque ว่าเมื่อไรควรใช้แบบใด
Section 5: Comprehension, Generator, dataclass และ Decorator
- List, Dictionary และ Set Comprehension และ Generator Expression
- Generator ด้วย yield สำหรับข้อมูลจำนวนมาก และ Pattern Matching ด้วย match
- dataclass แบบ frozen และ slots
- เขียน Decorator และ Context Manager ด้วย with และ contextlib
- Lab: Decorator จับเวลาและ Context Manager จัดการทรัพยากร