This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhr
Recipients Pasha2009, christian.heimes, rhr
Date 2008-12-10.13:55:35
SpamBayes Score 1.9236646e-05
Marked as misclassified No
Message-id <1228917337.28.0.113210090786.issue4619@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-12-10 13:55:37rhrsetrecipients: + rhr, christian.heimes, Pasha2009
2008-12-10 13:55:37rhrsetmessageid: <1228917337.28.0.113210090786.issue4619@psf.upfronthosting.co.za>
2008-12-10 13:55:36rhrlinkissue4619 messages
2008-12-10 13:55:35rhrcreate