ทำความเข้าใจทุกอย่างของ Python ผ่าน `builtin`
(sadh.life)-
บทความที่จัดวางให้ทำความเข้าใจ Python โดยอธิบายอ็อบเจ็กต์ built-in ในโมดูล builtins ทีละตัว
-
กฎ scope แบบ L.E.G.B. คืออะไร
-
dir(builtins)
→ คลาส Exception แบบ built-in 66 ตัว
→ ค่าคงที่ 5 ตัว: True, False, None, Ellipsis, NotImplemented
→ ตัวแปรโกลบอล: spec, loader, debug เป็นต้น
→ compile, exec, val: วิธีการทำงานของโค้ด
→ globals and locals: ที่เก็บของทุกสิ่ง
→ input and print: ของพื้นฐานที่ขาดไม่ได้
→ str, bytes, int, bool, float and complex: primitive 5 ชนิด
→ object: พื้นฐานของทุกสิ่ง
→ type: โรงงานสร้างคลาส
→ hash and id: พื้นฐานของ equality
→ dir and vars: ทุกอย่างคือ dictionary
→ hasattr, getattr, setattr and delattr: ตัวช่วยจัดการแอตทริบิวต์
→ super: พลังของ inheritance
→ property, classmethod and staticmethod: method decorators
→ list, tuple, dict, set and frozenset: คอนเทนเนอร์
→ bytearray and memoryview: อินเทอร์เฟซสำหรับ byte ที่ดีกว่า
→ bin, hex, oct, ord, chr and ascii: การแปลงพื้นฐาน
→ format: การแปลงข้อความอย่างง่าย
→ any and all
→ abs, divmod, pow and round: พื้นฐานของคณิตศาสตร์
→ isinstance and issubclass: การตรวจสอบ type ตอนรันไทม์
→ callable and duck typing basics
→ sorted and reversed: การเปลี่ยนแปลงซีเควนซ์
→ map and filter: functional primitives
→ len, max, min and sum: ฟังก์ชัน aggregate
→ iter and next: iteration ขั้นสูง
→ range, enumerate and zip: iteration ที่สะดวก
→ slice
→ breakpoint: การดีบักแบบ built-in
→ open: File I/O
→ repr: เพื่อความสะดวกของนักพัฒนา
→ help, exit and quit: site builtins
→ copyright, credits, license: site builtins อื่นๆ
1 ความคิดเห็น
เป็นบทความที่มีเอกลักษณ์มาก อธิบายให้เข้าใจ Python จากภายในได้อย่างง่ายและกระชับมากครับ