from Hacker News

Understanding Decorators in Python

by bascodes on 2/24/22, 4:23 PM with 4 comments

  • by tabtab on 2/24/22, 4:59 PM

    I'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 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.