args kwargs: error
Functions in python require arguments and you can be rather expressive with them. You can have functions that accept any number of arguments and there's many nice use-cases to be able to pass around keyword arguments. In this series of videos we'll explore how to use arguments (args) as well as keyword arguments (kwargs).
Let's have a look at the same function.
def function(a, b, *args, keyword=True, **kwargs): print(a, b) print(args) print(keyword) print(kwargs)
Note that this call will fail.
function(a=1, b=2, 5, 3, 4, param=42)
But this one will not.
function(1, 2, 5, 3, 4, param=42)
If you use the rule in the video you may remember why.
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider signing up for the newsletter.