Bizarre method keyword-arg bug.
bbrown at speakeasy.net
Wed Aug 20 19:09:21 CEST 2008
Fredrik Lundh <fredrik at pythonware.com> writes:
> Robert Brown wrote:
>> You may find the above surprising, but Common Lisp users expect the
>> default argument expression to be evaluated anew when needed by a
>> function call:
> well, I'd say an argument based on "Common Lisp users" is a lot more
> dubious ;-)
Actually, it's really not dubious. Because Lisp is extensible, Lisp *users*
have evolved the language considerably over the years. It's an excellent
place to look for alternative design ideas. For instance, Lisp users
experimented with several ways (LOOPS, Flavors, etc.) of supporting the
object oriented style of programming before CLOS became part of the Common
Lisp standard. If you're designing a language feature, it's often the case
that Lisp users have tried several alternatives over the last few decades
and have decided what works best, for them of course.
In any case, chances are high that Lisp's way of handling default arguments
would have been changed had it been shown to cause performance problems.
We're talking about a language used to implement operating systems --
performance is always a consideration.
More information about the Python-list