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 variable
exec("variable = 'newText'")
changeVariable()
print(str(variable))
----------
messages: 275657
nosy: Qwert225
priority: normal
severity: normal
status: open
title: String executed inside a function ignores global statements
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28064>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com