On 2/27/18 3:52 AM, Kirill Balunov wrote:
a.  Is this restriction for locals desirable in the implementation of
CPython in Python 3?
b.  Or is it the result of temporary fixes for Python 2?

My understanding is that the behavior of locals() is determined mostly by what is convenient for the implementors, so that they can keep regular code running as quickly as possible.  The answer to the question, "why can't we make locals() work more like I expect?" is, "because that would make things slower."

Personally, I find the convenient functionality to update the local symbol
table inside a function, similar to `globals`.

Can you show us an example of why you would want to update locals through locals()?  There might be more natural ways to solve your problem.

--Ned.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to