*args and **kwargs in Python
Introduction
In Python, we can pass a variable number of argumnets to a function using special symbols.
THere aer two special symbols
- *args (Non Keyword Arguments)
- **kwargs (Keyword Arguments)
Note : We use *args and **kwargs as an argument when we have no doubt about the number of arguments we should pass in a function.
*args
The special syntax *args in function definition in python is used to pass a variable number of arguments to a function.
**kwargs
**kwargs in function definition us used to pass a keyword variable length argument list,
We use the name kwargs with the double star. THe reason is that the double star allows us to pass through keyword arguments (and any number of them).
kwargs stands for keyworded arguments
Thanks for Reading!
If you like my work and want to support me…
- The BEST way to support me is by following me on Medium.
- I share tips, tricks and insights on #softwareengineering, #dataengineering #cloud #ml on LinkedIn.
- Feel free to give claps so I know how helpful this post was for you.
Do you want to connect with me I have started mentoring others for career and interviews at 𝐭𝐨𝐩𝐦𝐚𝐭𝐞.𝐢𝐨/𝐧𝐚𝐯𝐞𝐞𝐧𝐩𝐧