r/pythontips • u/social_tech_10 • Mar 08 '19
Python *args and **kwargs Made Easy
*args and **kwargs may seem scary, but the truth is that they are not that difficult to grasp and have the power to grant your functions with flexibility and readability.
50
Upvotes
4
Mar 08 '19
If I could add upvote multiple times I would do it now... simple, right to the point. I Finally understand them thanks to you... refactoring coming right up :)
1
11
u/basalamader Mar 08 '19
OP solid work. One change that I hope to impact is when you use
*.get()for dicts, you can set a default in case the key you are looking for is not found.so your first method would be one line of code: