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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 27 22:38:50 CEST 2011


With regard to "own" or "static", my feeling is that this
kind of feature (i.e. mutable shared state visible only to
one function) is an anti-pattern in language design. We
have much better ways nowadays of sharing state without
making it completely global, such as modules and classes.

There was a discussion a while back about a "const"
statement, which was essentially what we are talking
about here except that the name would be read-only.
This seems like both a better name and better semantics
to me.

As I remember, the idea foundered because it was thought
too confusing to have an expression that was written
inside the function but evaluated outside of it. If
we're seriously considering the current proposal,
presumably we've gotten over that? Or is it still a
valid objection?

-- 
Greg



More information about the Python-ideas mailing list