File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -571,9 +571,9 @@ value --- this is a syntactic restriction that is not expressed by the grammar.
571
571
**Default parameter values are evaluated from left to right when the function
572
572
definition is executed. ** This means that the expression is evaluated once, when
573
573
the function is defined, and that the same "pre-computed" value is used for each
574
- call. This is especially important to understand when a default parameter is a
574
+ call. This is especially important to understand when a default parameter value is a
575
575
mutable object, such as a list or a dictionary: if the function modifies the
576
- object (e.g. by appending an item to a list), the default value is in effect
576
+ object (e.g. by appending an item to a list), the default parameter value is in effect
577
577
modified. This is generally not what was intended. A way around this is to use
578
578
``None `` as the default, and explicitly test for it in the body of the function,
579
579
e.g.::
You can’t perform that action at this time.
0 commit comments