functools Module
functools มี higher-order functions และ utilities สำหรับทำงานกับ functions ใน Python เช่น caching, partial application, และ function composition
ลองนึกภาพว่าเรามี recursive function ที่ช้ามาก เช่น Fibonacci ใช้ @lru_cache decorator ครั้งเดียว เร็วขึ้นทันที หรือต้อง preset arguments บางตัว ใช้ partial() ได้เลย
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google