> there are no known examples of binary matrix multiplication results which may 
> used as decorators.

This is misleading. There are multiple libraries on PyPI that wrap up functions 
to add additional operators and methods including @ for compose. (It’s also 
been proposed and rejected repeatedly for the builtin type, going back to the 
rejected PEPs in 2000 that originally proposed a matmul operator.) And 
composing two decorators isn’t binary matrix multiplication, but it is a use of 
the @ operator; and it gives you results which could be used as decorators.

For example, if I have a logcall decorator that wraps its function with calls 
to logging.log that show when the function is entered and exited, and a daytime 
decorator that skips the function call if it’s nighttime, then logcall@daytime 
is a decorator which skips the function call if it’s nighttime but always logs 
either way, while daytime@logcall skips both.

I don’t think that this is a practical problem. I don’t know how often people 
use these libraries to compose decorators, but even if it’s very frequent 
(which it probably isn’t), it wouldn’t look at all ambiguous to a human to mix 
with this feature, because the following end up meaning the same thing:

    @daytime@logcall
    def cheese(…):

    @daytime
    @logcall
    def cheese(…):

Try it with composing decorators that take arguments and return the actual 
decorator, etc.; it’s never ambiguous or misleading to the reader.

So, I think the PEP can dismiss the problem, just not in the way it currently 
does.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/P7XVVMKN3OT7EN4XA267EYWYDKDKN7YH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to