[Python-Dev] q about default args

Eric S. Raymond esr@thyrsus.com
Thu, 22 Aug 2002 18:27:37 -0400


Stepan Koltsov <yozh@mx1.ru>:
> The question is: To be or^H^H^H^H^H^H^H^H^H Why not evaluate default
> parameters of a function at THE function call, not at function def
> (as is done currenly)? For example, C++ (a nice language, isn't it? ;-)
> ) evaluates default parameters at function call.

Among other things, because that choice (what old LISP hackers like me
call `dynamic scoping') turns out to be far more difficult to model
mentally than Python's lexical scoping.   Forty years of LISP experience
says Python does the right thing.
-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>