[Python-Dev] Deprecating locals() (was Re: nested scopes and global: some corner cases)

Guido van Rossum guido@digicool.com
Sun, 11 Mar 2001 16:37:14 -0500


> When Guido
> says he intends to "deprecate" exec-without-in, he should also always say
> "and also deprecate exec in locals()/global() too".  But he'll have to think
> about that and get back to you <wink>.

Actually, I intend to deprecate locals().  For now, globals() are
fine.  I also intend to deprecate vars(), at least in the form that is
equivalent to locals().

> Note that modifications to locals() already have undefined behavior
> (according to the Ref Man), so exec-in-locals() is undefined too if the
> exec'ed code tries to (re)bind any names.

And that's the basis for deprecating it.

--Guido van Rossum (home page: http://www.python.org/~guido/)