Python Decorators Considered Harmful

Python Decorators Considered Harmful

18.730 Lượt nghe
Python Decorators Considered Harmful
💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Python decorators look like a great way to add functionality—until they break your type safety, hide function requirements, and turn debugging into a nightmare. In this video, I’ll show you why decorators can be dangerous, the biggest pitfalls to watch out for, and when you should actually use them. 🔥 GitHub Repository: https://git.arjan.codes/2025/decorators. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 🔖 Chapters: 0:00 Intro 0:25 What Is a Python Decorator? 1:50 How to Write Your Own Decorator 5:26 Problem 1: The Order of Decorators Can Cause Unexpected Bugs 8:20 Problem 2: Decorators Can Break Code Analysis and Typing 10:18 Problem 3: Hidden Function Requirements 13:19 Other Issues with Decorators 14:17 Final Thoughts 14:44 Outro #arjancodes #softwaredesign #python