On 14 Apr 2007 20:20:42 -0700, Paddy <[EMAIL PROTECTED]> wrote: > On Apr 15, 3:58 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: > > On Sat, 14 Apr 2007 17:33:11 -0800, Troy Melhase wrote: > > > On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: > > >> While trying to write a recursive function involving lists, I came > > >> across some (to me) odd behavior which I don't quite understand. Here's > > >> a trivial function showing the problem. > > > > > fromhttp://docs.python.org/ref/function.html: > > > > > Default parameter values are evaluated when the function definition is > > > executed. This means that the expression is evaluated once, when the > > > function is defined, and that that same ``pre-computed'' value is used > > > for each call. This is especially important to understand when a > > > default parameter is a mutable object, such as a list or a dictionary: > > > if the function modifies the object (e.g. by appending an item to a > > > list), the default value is in effect modified. > > > > This comes up so often that I wonder whether Python should issue a warning > > when it sees [] or {} as a default argument. > > > > What do people think? A misuse or good use of warnings? > > > > -- > > Steven. > > I wonder if it is a check done by Pylint or PyChecker?
It is a check done by pylint Tim > > - Paddy. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list