In Python 2.x (I use 2.7), which is the proper way to use default arguments with *args and **kwargs? I\'ve found a question on
*args
**kwargs
The syntax in the other question is python3.x only and specifies keyword only arguments. It doesn't work on python2.x.
For python2.x, I would pop it out of kwargs:
pop
def func(arg1, arg2, *args, **kwargs): opt_arg = kwargs.pop('opt_arg', 'def_val')