[Python-ideas] Re: Add decorator_with_params function to functools module

2020-12-24 Thread Yurii Karabas
Sorry for the long response. After investigation, I have found that there is a third-party library called `decorator` which do smth similar to what I propose (I didn't know about that library when I created this thread). As I said, the idea of `decorator_factory` is to create a unified way of

[Python-ideas] Re: Add decorator_with_params function to functools module

2020-11-30 Thread Joao S. O. Bueno
Is it really worth it? Fact is, while it can shave off some lines of code, I think it is interesting to know _which_ lines of code - Usually when one writes a decorator, it is expected that they will know what they are writing, and will want to be in control of their code. Delegating this to a

[Python-ideas] Re: Add decorator_with_params function to functools module

2020-11-30 Thread Yurii Karabas
The idea of `decorator_factory` is to eliminate boilerplate code that used to create a decorator with parameters. A perfect example is how `dataclass` decorator can be simplified from this: ``` def dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False,

[Python-ideas] Re: Add decorator_with_params function to functools module

2020-11-30 Thread Yurii Karabas
After discussion at the python issue tracker, the better name `decorator_factory` was proposed. I have just gone through the standard library code to find places where `decorator_factory` can be used. 1. `dataclasses.dataclass` ``` def dataclass(cls=None, /, *, init=True, repr=True, eq=True,

[Python-ideas] Re: Add decorator_with_params function to functools module

2020-11-29 Thread Marco Sulla
You can use classes as decorators, it's quite more simple: https://towardsdatascience.com/using-class-decorators-in-python-2807ef52d273?gi=ea5091974462 ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to