Message384382
I think the idea is a plausible and well-presented suggestion, but I'm afraid I'm still going to agree with the view that we shouldn't add this.
From a maintainability point of view, *generically* detecting the difference between "applied without parentheses as a decorator" and "called with parameters to produce a partial function to be used as a decorator" isn't quite as simple as just calling "callable(args[0])", since it's entirely possible for decorator factories to accept callables as parameters. We could try to document our way around that problem, but we wouldn't be able to eliminate it entirely.
Given the relative rarity of the use case, and the potential for subtle issues when the assumptions of the decorator_factory decorator aren't met, I'm happy to leave this task to inline mostly-but-not-completely-boilerplate code rather than trying to abstract it away. |
|
Date |
User |
Action |
Args |
2021-01-05 11:24:00 | ncoghlan | set | recipients:
+ ncoghlan, rhettinger, serhiy.storchaka, BTaskaya, uriyyo |
2021-01-05 11:24:00 | ncoghlan | set | messageid: <1609845840.55.0.170831240592.issue42455@roundup.psfhosted.org> |
2021-01-05 11:24:00 | ncoghlan | link | issue42455 messages |
2021-01-05 11:23:59 | ncoghlan | create | |
|