r/pythonhelp • u/Remarkable-Avocado44 • Apr 07 '21
Misunderstanding Functions: Keyword Arguments with Default Parameters
Hi. Working MIT 6.0001
Chapter 4.1.2 in the John Guttag Text

I'm having trouble understanding how to interpret the boolean here? In the first line of the body:
###########
if reverse:
print('Olga', 'Puchmajerova' )
###############
If reverse evaluates to True?
Or is it saying whatever you defined as the default parameter is a constant, and if the argument taken by the function is equivalent to that value, its true? So basically if you input false, then it evaluates to true? If you input True it's else?
I'm super confused here.
2
Upvotes
2
u/Remarkable-Avocado44 Apr 07 '21 edited Apr 07 '21
Thank you for this; that was among the clearest, calmest, simplest video descriptions i've seen. I just subscribed to your channel.
I believe i've understood your example.
A default function paramater is a placeholder; its exists as one of the parameters of the function, if that paramter is not supplied during the function call.
If the parameter is given during the function call, the default parameter is ignored/overidden.