Is it always safe to pass an empty argument as a keyword argument?

Are there any cases when

f(arg1, arg2..., argN) 

works and produces the result and

 f(arg1, arg2..., argN, **{} ) 

gives a different result or causes an error?

I assume **kwds is not yet in the argument list.

The context is that I am writing a functor containing a function and arguments for further evaluation and want to support optional keywords.

+4
source share
1 answer

Yes, it is always safe. These two calls are completely equivalent, and the f() function does not have the ability to distinguish between them (except, of course, the introspection of the source code).

+4
source

All Articles