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

Tim Peters tim.one@home.com
Sun, 11 Mar 2001 22:25:56 -0500


[Guido]
> 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().

OK by me.  Note that we agreed long ago that if nested scopes ever made it
in, we would need to supply a way to get a "namespace mapping" object so that
stuff like:

    print "The value of i is %(i)s and j %(j)s" % locals()

could be replaced by:

    print "The value of i is %(i)s and j %(j)s" % namespace_map_object()

Also agreed this need not be a dict; fine by me if it's immutable too.