Is there are good DRY fix for this painful design pattern?
Ian Kelly
ian.g.kelly at gmail.com
Mon Feb 26 16:37:11 EST 2018
On Mon, Feb 26, 2018 at 1:09 PM, <marco.nawijn at colosso.nl> wrote:
> def foo(self, *args, **kwargs):
> assert len(args) == 0
Better:
def foo(self, **kwargs):
> So, use the inspect module to detect the valid arguments
> from the class initializer. Then use **kwargs in every
> class method. It would be nice if the full method signature
> can be kept, but I have not yet figured out if this is
> possible.
https://pypi.python.org/pypi/decorator/4.2.1
More information about the Python-list
mailing list