[Python-Dev] q about default args
Eric Tiedemann
est@hyperreal.org
Thu, 22 Aug 2002 23:37:56 -0700 (PDT)
Eric S. Raymond discourseth:
> Andrew P. Lentvorski <bsder@mail.allcaps.org>:
> > > 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.
> >
> > That statement sounds like someone spent a lot of time doing research on
> > it. Is there a reference I could go look up?
>
> It's sort of a folk theorem derived from painful experience. Nobody
> has proposed a new LISP dialect with lexical scoping since the mid-1980s.
> Scheme and Common LISP, both lexically scoped, pretty much settled the
> controversy.
http://citeseer.nj.nec.com/steele93evolution.html has some good
coverage of this.
When it comes to the original topic (the handling of default
arguments), I think it's possible to separate time of evaluation and
scope of evaluation. Call-time and static-scoping seem like good
choices to me. Being able to refer to parameters to the left of the
one you're defaulting can be especially handy.
E