=== on 21 Nov 2019, 18:13:10 Nicolas Harraudeau wrote:
Closing this rule as it would raise many False Positives. I see multiple cases where passing ``++**kwargs++`` or ``++*args++`` is perfectly fine:

1/ building an argument list on the fly. Example:

----
options = {}
if condition:
    options[key] = value
myfunction(**options)

# One could argue that this is equivalent:
key = default
if condition:
   key = value
myfunction(key = value)
# But actually this overrides the default value of "key" set in myfunction.
----

2/ It is very common to forward arguments you don't know much about from a caller to another method/function.


----
def myfilter(func):
    def decorator(*args, c=None, **kwargs):
        if c is None or c < 0:
            return None
        return func(c=c, *args, **kwargs)
    return decorator

@myfilter
def myfunction(a, b, *args, c=None):
    return 42
print(myfunction(1,2,c=-1))
----

