Message360149
exec() function is currently quite clear on which types are accepted or not: exact dict for globals, mapping for locals.
* "If only globals is provided, it must be a dictionary (and not a subclass of dictionary), which will be used for both the global and the local variables."
* "If provided, locals can be any mapping object."
Moreover, the requirement on the exact dict type allowed to implement an optimization on globals in Python 3.8:
"LOAD_GLOBAL instruction now uses new “per opcode cache” mechanism. It is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in bpo-26219.)" |
|
Date |
User |
Action |
Args |
2020-01-16 22:18:38 | vstinner | set | recipients:
+ vstinner, terry.reedy, pfalcon, ppperry, pablogsal |
2020-01-16 22:18:38 | vstinner | set | messageid: <1579213118.04.0.33684352053.issue32615@roundup.psfhosted.org> |
2020-01-16 22:18:38 | vstinner | link | issue32615 messages |
2020-01-16 22:18:37 | vstinner | create | |
|