On Thu, Aug 06, 2020 at 08:11:50AM -0000, redradist@gmail.com wrote:
I think a property decorator can be useful, because you consider the simplest case with:
We already have `property`, which can be used as a decorator.
class MyClass: @my_property name = arg
How is it different from
name = my_property(arg)
which is possible right now, you don't need decorator syntax.
All it will be possible if attribute decorator will have the following signature:
All of it is possible *right now*. You don't need decorator syntax to do any of those examples you show, you just need function calls.
You keep showing examples of function calls that do marvellous things, but at no point have you shown any reason why those functions need to be called using decorator syntax instead of ordinary function call syntax.
With your decorator suggestion, your marvellous function can only take a single argument:
@function # takes a single argument name = arg
but with regular function calls, you can pass any combinations of positional and keyword arguments:
name = function(arg, more, args, key=value, word=thing)
So it seems to me that you want to add special syntax that is *less* powerful than what we already have. Why does this have to use decorator syntax?
Please don't give us another list of fantastic things that you can do with function calls, we already know that function calls can do anything. Tell us how the `@function` syntax is better than the `function(arg)` syntax.