I have a very basic function.
def greet(name, msg = "Good morning!"):
"""
This function greets to
the person with the
provided message.
If message is not provided,
it defaults to "Good
morning!"
"""
print("Hello",name + ', ' + msg)
Now when I am calling __kwdefaults__ on the function I am getting None.
3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)]
Python Type "help", "copyright", "credits" or "license" for more information.
from python_methods import greet
greet("Kate")
Hello Kate, Good morning!
greet("Bruce","How do you do?")
Hello Bruce, How do you do?
print(greet.__kwdefaults__)
None
What am I missing here? Should not I get {“msg”: “Good morning!”} ?
Thanks,
Arup Rakshit
[email protected]
--
https://mail.python.org/mailman/listinfo/python-list