this post was submitted on 08 May 2025
16 points (80.8% liked)

Python

7076 readers
54 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

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. This video shows you why decorators can be dangerous, the biggest pitfalls to watch out for, and when you should actually use them.

you are viewing a single comment's thread
view the rest of the comments
[–] jimmux 10 points 20 hours ago

I can live with decorators in Python (and JavaScript while we're at it) because they're kind of in the spirit of the language. You have a big bag of tools and are trusted to use them responsibly.

I've only had problems when annotations in Java are used to do similar things. At some point you have to admit that all the bypassing of language features means you picked the wrong language, and maybe you don't want rigorous OO purity after all.