4 ms·
If you really wanted to make the parameters optional, you could have your decorator accept ( callable = None, ^^kwargs ) and then check if `callable` is a funct
by knome 11y ago
If you really wanted to make the parameters optional, you could have your decorator accept ( callable = None, ^^kwargs ) and then check if `callable` is a function object ( or class / callable / whatever ) or None. If it is a direct application of the decorator then directly decorate with defaults, otherwise return a wrapping function with the given parameters to await the function as need be.
annoyed edit: replace ^ with asterisk, which I can't get HN to print even escaping them with backslashes. thanks bad syntax formatting code