def func(a, b = 100):
return a + b
func(a)
func(a,b = 100)
Is there any way to tell when func is called, b value 100 is taken from the default or keyword parameter?
No, not as you've written your code. However, you can do:
def func(a, b=None):
if b is None:
b = 100
return a + b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With