On 1/29/07, Chris Rebert email@example.com wrote:
George Sakkis wrote:
As I see it, the main objection to this is the inversal of the current default semantics: every default argument is treated as if it were mutable, or re-evaluatable more generally. Although mutable default arguments are useful some times and would be nice to have, they are most likely less common than the immutable ones, so the latter should be the default.
Why? Yes, there _might_ be performance issues (which have yet to be demonstrated or deeply speculated upon), but re-evaluating immutable default arguments wouldn't affect a program's correct operation.
If the underlying intent of your proposal -- that all default arguments be re-evaluated with every call -- were to be approved, there would undoubtedly be a serious performance impact. The alternative is an ugly, narrow-use syntax that seeks to eliminate two lines of boilerplate per default argument, boilerplate that can already be replaced with decorators.
As for whether these effects have "yet to be demonstrated", as you say, the burden is on you, the PEP author, to investigate and resolve, mitigate or justify any and all performance changes.