[New-bugs-announce] [issue9646] Mutable default function parameter warning

Sérgio Surkamp report at bugs.python.org
Thu Aug 19 20:42:10 CEST 2010


New submission from Sérgio Surkamp <sergio at gruposinternet.com.br>:

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.

Documentation reference:
http://docs.python.org/reference/compound_stmts.html#function

----------
components: None
messages: 114394
nosy: surkamp
priority: normal
severity: normal
status: open
title: Mutable default function parameter warning
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9646>
_______________________________________


More information about the New-bugs-announce mailing list