I'm learning Python and playing around with function arguments. Just created a test function with following code:
def packer(name = 'Alpha', **kwargs):
return(kwargs)
And if I call this function as:
dummy_packer = packer(name = 'Bravo', age = 65, beard = False)
The result is:
{'age': 65, 'beard': False}
The variable dummy_packer will not have name value at all in the result. I understand it ignored it because I have defined already at the stage of creating the function. But then why it didn't give me the default value also? Where the name argument is stored?
Thanks
nameargument is stored in thenamevariable.**kwargsdoesn't mean "all arguments passed by keyword", it means "all arguments passed by keyword that aren't named in the function signature".