[issue28064] String executed inside a function ignores global statements

2016-09-10 Thread Xiang Zhang
Xiang Zhang added the comment: Not a bug. Put the global statement inside: >>> variable = 'test' >>> def changeVariable(): ... exec("global variable; variable = 'newText'") ... >>> changeVariable() >>> print(variable) newText -- nosy: +xiang.zhang resolution: -> not a bug stage:

[issue28064] String executed inside a function ignores global statements

2016-09-10 Thread Qwert225
New submission from Qwert225: String executed inside a function ignores global statements stated before string execution. See the example below - the global variable value should be changed to 'newText' by the function, but is not. Example: variable = 'text' def changeVariable(): global