Python2.6ã¨ã㧠>>> def foo(): ... locals()["hoge"] = 1 ... print hoge ... >>> foo() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in foo NameError: global name 'hoge' is not defined ãããªãããã§ãããã¯ãã¼ã«ã«ã®åå空éãæé©åã®é¢ä¿ã§æ¸ãæãä¸å¯ã«ãªã£ã¦ãã¦locals()ãè¿ãã®ã¯ãã®ã³ãã¼ãè¾æ¸ã©ã¤ã¯ã«ãããã®ã ã¨æã£ã¦ããã ã ã§ãããã£ã¦ã³ã³ãã¤ã«æã«hogeãåå¨ããªãããLOAD_GLOBALã«ãªã£ã¦ããã£ã¦ã ã㧠>>> import dis >>> dis.dis(foo) 2 0 LOAD_CON
{{#tags}}- {{label}}
{{/tags}}