homepage

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.

Author steven.daprano
Recipients docs@python, steven.daprano
Date 2016年06月16日.17:35:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466098501.84.0.0349098094976.issue27335@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016年06月16日 17:35:01steven.dapranosetrecipients: + steven.daprano, docs@python
2016年06月16日 17:35:01steven.dapranosetmessageid: <1466098501.84.0.0349098094976.issue27335@psf.upfronthosting.co.za>
2016年06月16日 17:35:01steven.dapranolinkissue27335 messages
2016年06月16日 17:35:01steven.dapranocreate

AltStyle によって変換されたページ (->オリジナル) /