
On Thu, May 27, 2021 at 1:40 PM Matt del Valle <matthewgdv@gmail.com> wrote:
...
Oh, and I think I've just discovered another thing that I'm not 100% sure I
like. Even putting aside that I'm not a fan of decorators on the same line as the statement they are decorating (as I mentioned in an earlier response), you've got examples of variable decorators where no assignment is happening such as:
@decorator var
To me this breaks the symmetry between function decorators, which always decorate a function definition (an implicit form of assignment), and the proposed variable decorators.
They are also confusing in the sense that the decorator is de-facto turning an otherwise invalid python statement legal. If you remove the decorator from the above example you will presumably get a `NameError`.
I imagine this would then have to be special-cased somehow in the language spec so that an undefined name is not evaluated, but only when preceded by a decorator? I don't know, it seems messy to me.
Also, I just can't quite see the value in them if I'm honest, whereas the version that is applied to an assignment statement:
@decorator var: bool = True
And even a bare type-hint version:
@decorator var: bool
seem to me to be far more self-evidently useful.
Ok, agreed on all points. I think an eventual full-fledged proposal could easily put naked decorations like: @decorator var ...to the wayside, to be added later if people have a really good reason for it. --- Ricky. "I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler