[Tutor] Question on lists

Joseph J. Strout joe@strout.net
Thu, 18 Mar 1999 13:42:35 -0800


At 1:23 PM -0800 03/18/99, David Ascher wrote:

>That's because of the famous 'mutable default argument problem', discussed
>in the FAQ Question 6.25 http://www.python.org/doc/FAQ.html#6.25.
>
>The solution is to use None and do a test in the body of the function

A better solution still (IMHO) is to not pass the working content back to
the function at all, but instead to return it and append it locally, as in
the code I posted this morning.

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'