On Mon, May 11, 2009, Tennessee Leeuwenburg wrote:
On Sun, May 10, 2009 at 11:23 AM, Steven D'Aprano firstname.lastname@example.org:
(1) Assignments outside of the body of a function happen once, at compile time. Default values are outside the body of the function. You want a special case for default values so that they too happen at runtime. That's not special enough to warrant breaking the rules.
Your logic is impeccable :) ... yet, if I may continue to push my wheelbarrow uphill for a moment longer, I would argue that is an implementation detail, not a piece of design philosophy.
I'm not going to look it up, but in the past, Guido has essentially claimed that this behavior is by design (not so much by itself but in conjunction with other deliberate decisions). I remind you of this:
"Programming language design is not a rational science. Most reasoning about it is at best rationalization of gut feelings, and at worst plain wrong." --GvR, python-ideas, 2009-3-1