I was wondering if this is considered an assignment in Python or not
def func(a,b,c=10): return a+b+c
Is c = 10 syntax assigns 10 to the argument c here ?
Is
c = 10syntax assigns 10 to the argument c here ?
Not necessarily. If the function is called func(1,2,3) then 10 is not assigned to c. That's the whole point of a default argument value, it's used only if not specified by the caller.
Assuming that the caller doesn't specify a value, then the default is assigned to c in the same sense that the specified arguments are assigned to a and b.
However, this is not an "assignment statement", so there are facts about assignment statements that aren't true of this (probably the most important difference, although it doesn't matter in this example of 10, is that the right hand side of this isn't evaluated each time, whereas the right hand side of an assignment statement is evaluated each time it's executed). So in the context of talking about "assignments" meaning "assignment statements", it wouldn't be considered an assignment.
chas the value10if none is given whenfuncis called. The=is a default parameter definition.