Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a8fbe7

Browse files
committed
Include "instances of most classes" in a warning about mutable objects
as default values of function/method parameters.
1 parent 5edd785 commit 3a8fbe7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/tut/tut.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,8 +1388,9 @@ \subsection{Default Argument Values \label{defaultArgs}}
13881388

13891389
\strong{Important warning:} The default value is evaluated only once.
13901390
This makes a difference when the default is a mutable object such as a
1391-
list or dictionary. For example, the following function accumulates
1392-
the arguments passed to it on subsequent calls:
1391+
list, dictionary, or instances of most classes. For example, the
1392+
following function accumulates the arguments passed to it on
1393+
subsequent calls:
13931394

13941395
\begin{verbatim}
13951396
def f(a, L=[]):

0 commit comments

Comments
 (0)