args and kwargs in Python : The Mystery of Asterisks in Python – Ali Raza Bhayani

args kwargs python alirazabhayani aliraza

Questions addressed in this post:

  • How can I define functions in Python and what are parameters?
  • What is Advanced Parameter Handling For Functions?
  • How can I use args(*) and kwargs(**) in Python?

What you will learn:

  • Define a function that takes parameters.
  • Args(* Arguments) and kwargs(** Keyword Arguments) and how to use them.
  • Set default values for function parameters.
  • Explain how we can use args(*) and kwargs(*) for Advanced Parameter Handling For Functions and Decorators

Ok so let’s dive in the code. Also read the code comments for better understanding: