On Tue, 30 Jan 2007 06:40:35 +0100, Chris Rebert
George Sakkis wrote:
I'm sure that the python-devs and the BDFL would have thought about it quite a bit when the current semantics were decided,
...which was probably a while ago. They might reconsider the issue now that some time has passed and they've seen how their decision has worked out. But yes, your analysis is a definite possibility.
Just looked it up, and python has had lexical variables since version 2.1, and default arguments since long before that. (forever?) Without lexical variables it's near impossible to implement re-evaluating default arguments, because the variables those default expressions refer to may no longer be available at function call time. So, The BDFL and other python devs didn't really have a choice but to have the default expressions evaluate at definition time (or implement lexical scopes, which is what has happened by now). Jan