Message77541
Reopening of issue 4181.
Evaluating default parameter values when the function definition is
executed is a design bug.
Even the documentation of this behaviour (see
http://docs.python.org/reference/compound_stmts.html#index-754) makes
this clear by stating: "This is generally not what was intended." It
then makes a suggestion for a workaround ("A way around this ..."). Only
bugs need workarounds.
An interface or behaviour should fulfil a users expectation for the
"normal" case, not for some "special" case. For a default parameter
value a user expects that whenever this function gets called a new
instance of a mutable object is created. This is much closer to the
current behaviour for non-mutable objects.
Usage cases for the current default behaviour are less common. |
|
Date |
User |
Action |
Args |
2008-12-10 13:55:37 | rhr | set | recipients:
+ rhr, christian.heimes, Pasha2009 |
2008-12-10 13:55:37 | rhr | set | messageid: <1228917337.28.0.113210090786.issue4619@psf.upfronthosting.co.za> |
2008-12-10 13:55:36 | rhr | link | issue4619 messages |
2008-12-10 13:55:35 | rhr | create | |
|