[issue44028] Request for locals().update() to work, it is

2021-05-09 Thread wang xuancong
wang xuancong added the comment: Thanks @terry.reedy for your expert-level good comments! 1. "In Python 3, the one *implementation*, and its lookup mode, are fixed. The slower implementation was dropped because it was not thought worth the bother." If I remember correctly, the performance

[issue44028] Request for locals().update() to work, it is

2021-05-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: When quoting, please include the source, preferably a direct link. In Python 1 and 2, there were two function local namespace *implementations* -- array index by number or dictionary indexed by name. The implementation, and hence the lookup mode, was fixed

[issue44028] Request for locals().update() to work, it is

2021-05-04 Thread wang xuancong
wang xuancong added the comment: Of course, I am aware of that. As elite-level Python programmers, we should all be aware of security issues whenever we deal with exec() and eval(). -- ___ Python tracker

[issue44028] Request for locals().update() to work, it is

2021-05-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: > loading the entire game or DNN (from STDIN) can be simply put into one line > as `locals().update(eval(sys.stdin.read()))` This is how you get command injection attacks. https://owasp.org/www-community/attacks/Command_Injection

[issue44028] Request for locals().update() to work, it is

2021-05-03 Thread wang xuancong
New submission from wang xuancong : In general, the ability to update local variables is very important and it simplifies life tremendously. For example, in machine learning, it allows saving/loading arbitrary-format datasets and arbitrary-structure neural networks (NN) using a single line