Understanding Decorators in Python
bas.codes
Understanding Decorators in Python
1–5 of 5 posts
Re: Understanding Decorators in Python
#2True, it's hard to just throw everything out and start over, but at least recognize the problem so that next generation of languages can solve/avoid it.
Removing or softening the distinction between object and class is perhaps a start.
Re: Understanding Decorators in Python
#3I'm gonna take vote hits, but truth is needed here. Python Decorators and C#/Java "attributes" are a sham. If their OOP model were powerful enough, they could just use OOP composition to get the same thing and not have to invent a new kind of thing: it would all just be objects referencing objects. They are a sign of poor or obsolete language design. True, it's hard to just throw everything out and start over, but at…
Aren't decorators just syntactic sugar for composition?
Re: Understanding Decorators in Python
#4I'm gonna take vote hits, but truth is needed here. Python Decorators and C#/Java "attributes" are a sham. If their OOP model were powerful enough, they could just use OOP composition to get the same thing and not have to invent a new kind of thing: it would all just be objects referencing objects. They are a sign of poor or obsolete language design. True, it's hard to just throw everything out and start over, but at…
> they could just use OOP composition to get the same thing and not have to invent a new kind of thing: it would all just be objects referencing objects. Aren't decorators just syntactic sugar for composition?
Re: Understanding Decorators in Python
#5Earlier quoted context omitted.
> they could just use OOP composition to get the same thing and not have to invent a new kind of thing: it would all just be objects referencing objects. Aren't decorators just syntactic sugar for composition?
In a way. However, I'd probably choose a different syntactical shortcut that looks more like the existing syntax or is a variation of.