Commit 458318a3 authored by Fred Drake's avatar Fred Drake

Include "instances of most classes" in a warning about mutable objects

as default values of function/method parameters.
parent 5b30ade0
......@@ -1388,8 +1388,9 @@ will print \code{5}.
\strong{Important warning:} The default value is evaluated only once.
This makes a difference when the default is a mutable object such as a
list or dictionary. For example, the following function accumulates
the arguments passed to it on subsequent calls:
list, dictionary, or instances of most classes. For example, the
following function accumulates the arguments passed to it on
subsequent calls:
\begin{verbatim}
def f(a, L=[]):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment