File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1353,7 +1353,10 @@ \subsection{Default Argument Values \label{defaultArgs}}
13531353
13541354\begin {verbatim }
13551355i = 5
1356- def f(arg = i): print arg
1356+
1357+ def f(arg=i):
1358+ print arg
1359+
13571360i = 6
13581361f()
13591362\end {verbatim }
@@ -1366,9 +1369,10 @@ \subsection{Default Argument Values \label{defaultArgs}}
13661369the arguments passed to it on subsequent calls:
13671370
13681371\begin {verbatim }
1369- def f(a, l = []):
1370- l.append(a)
1371- return l
1372+ def f(a, L=[]):
1373+ L.append(a)
1374+ return L
1375+
13721376print f(1)
13731377print f(2)
13741378print f(3)
@@ -1386,11 +1390,11 @@ \subsection{Default Argument Values \label{defaultArgs}}
13861390you can write the function like this instead:
13871391
13881392\begin {verbatim }
1389- def f(a, l = None):
1390- if l is None:
1391- l = []
1392- l .append(a)
1393- return l
1393+ def f(a, L= None):
1394+ if L is None:
1395+ L = []
1396+ L .append(a)
1397+ return L
13941398\end {verbatim }
13951399
13961400\subsection {Keyword Arguments \label {keywordArgs } }
You can’t perform that action at this time.
0 commit comments