This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年06月16日 17:35 by steven.daprano, last changed 2022年04月11日 14:58 by admin.
| Messages (2) | |||
|---|---|---|---|
| msg268682 - (view) | Author: Steven D'Aprano (steven.daprano) * (Python committer) | Date: 2016年06月16日 17:35 | |
The docs for locals() warn not to write to the dict returned, as it may not have the intended effect of modifying the actual variables seen by the interpreter. https://docs.python.org/3/library/functions.html#locals But as I understanding it, using locals() inside a class body is intentionally supported: class K: locals()['x'] = 1 assert K.x == 1 is not just an accident of implementation, but the intended behaviour and a language guarantee. |
|||
| msg268704 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月16日 23:58 | |
I think my proposed patch for Issue 17546 addresses this. That patch was also written to address Issue 17960. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:32 | admin | set | github: 71522 |
| 2016年06月16日 23:58:04 | martin.panter | set | nosy:
+ martin.panter messages: + msg268704 |
| 2016年06月16日 17:35:01 | steven.daprano | create | |