
On 05/16/2014 07:08 PM, MRAB wrote:
On 2014-05-17 02:40, Chris B wrote:
Right now, one can use the @ symbol only for decorations and only bofore function or class definition. ("A decorator is just a callable that takes a function as an argument and returns a replacement function.").
@dec1(arg) @dec2 def func(): pass
If a function has already been defined, it cannot be decorated using the decoration operator. But it can still be decorated by explicitly calling the decorator:
@dec1(arg) @dec2 def func(): pass
is equivalent to:
def func(): pass func = dec1(arg)(dec2(func))
Now I propose that the @ symbol should also be usable as an assignment operator, in which case a succeeding function definition would not be decorated:
[snip] There is a proposal to use @ as an operator for matrix multiplication:
Which has been accepted.
-- ~Ethan~