diff options
author | Andre Delfino <adelfino@gmail.com> | 2020-07-22 23:58:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-22 23:58:19 (GMT) |
commit | b9f6ac9d463b3c5823197b0bde3869876f65f413 (patch) | |
tree | 2ebb248dcf7dd21d45ba8d21297096eeb88c0232 | |
parent | 9b9f1582753979f38d2fd927cddf0621a65e9ed6 (diff) | |
download | cpython-b9f6ac9d463b3c5823197b0bde3869876f65f413.zip cpython-b9f6ac9d463b3c5823197b0bde3869876f65f413.tar.gz cpython-b9f6ac9d463b3c5823197b0bde3869876f65f413.tar.bz2 |
Stick with the phrase "default parameter value" (GH-21590)
-rw-r--r-- | Doc/reference/compound_stmts.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index c14e7c7..df720f6 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -571,9 +571,9 @@ value --- this is a syntactic restriction that is not expressed by the grammar. **Default parameter values are evaluated from left to right when the function definition is executed.** This means that the expression is evaluated once, when the function is defined, and that the same "pre-computed" value is used for each -call. This is especially important to understand when a default parameter is a +call. This is especially important to understand when a default parameter value is a mutable object, such as a list or a dictionary: if the function modifies the -object (e.g. by appending an item to a list), the default value is in effect +object (e.g. by appending an item to a list), the default parameter value is in effect modified. This is generally not what was intended. A way around this is to use ``None`` as the default, and explicitly test for it in the body of the function, e.g.:: |