less hostile to newbie use at the interactive prompt.
This is in response to SF bug #458654.
\begin{verbatim}
i = 5
-def f(arg = i): print arg
+
+def f(arg=i):
+ print arg
+
i = 6
f()
\end{verbatim}
the arguments passed to it on subsequent calls:
\begin{verbatim}
-def f(a, l = []):
- l.append(a)
- return l
+def f(a, L=[]):
+ L.append(a)
+ return L
+
print f(1)
print f(2)
print f(3)
you can write the function like this instead:
\begin{verbatim}
-def f(a, l = None):
- if l is None:
- l = []
- l.append(a)
- return l
+def f(a, L=None):
+ if L is None:
+ L = []
+ L.append(a)
+ return L
\end{verbatim}
\subsection{Keyword Arguments \label{keywordArgs}}