[Python-ideas] Mutable default function parameter warning

Sérgio Surkamp sergio at gruposinternet.com.br
Mon Aug 23 16:55:47 CEST 2010

Hello list,

The documentation states that the default value of function parameter,
if mutable, can change it's default value at runtime due to be
evaluated only once on function object creation.

I would like to suggest the inclusion of an default language warning
when this kind of construction is used, as it's Python specific
behavior and can lead to "strange behavior" or misuse by programmers
that are migrating from other languages to Python.

This proposal was first open as a suggestion issue in bug track, but,
as a request from Mr. Peterson, I'm rewriting it to this list.

.:'        `     Sérgio Surkamp | Gerente de Rede
::    ........   sergio at gruposinternet.com.br
`:.        .:'
  `:,   ,.:'     *Grupos Internet S.A.*
    `: :'        R. Lauro Linhares, 2123 Torre B - Sala 201
     : :         Trindade - Florianópolis - SC
     ::          +55 48 3234-4109
     '           http://www.gruposinternet.com.br

More information about the Python-ideas mailing list