logo

... args kwargs.


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).


Episode Notes

We've expanded the function to also be able to handle many keyword arguments. Feel free to play around with function inputs. Understanding the print statements here is important.

def function(a, b, *args, keyword=True, **kwargs):
    print(a, b)
    print(args)
    print(keyword)
    print(kwargs)

Feedback? See an issue? Feel free to mention it here.

If you want to be kept up to date, consider getting the newsletter.