[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Eric Snow ericsnowcurrently at gmail.com
Wed Sep 28 00:42:19 CEST 2011

On Tue, Sep 27, 2011 at 4:24 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Ultimately, it seems like we are looking for a way to do three things here:
> 1. bless a concrete function definition scope (persist across calls),
> 2. allow one-time initialization of those persistent variables,
> 3. (relatedly) have some expressions evaluated at definition time but
> available at execution time.
> Default arguments cover some of this.  Closures cover some of it.  The
> nonlocal-from statement covers a bunch.

As do function attributes...  However, the big motivator here is
execution performance where it matters: in functions.

> -eric

More information about the Python-ideas mailing list