[issue37234] error in variable

2019-06-11 Thread Steve Dower
Steve Dower added the comment: This is intended behavior. When a variable has an assignment anywhere in a function, it becomes a local. Once a local variable exists, it will shadow the non-local variable. So by having the "n =", you are marking "n" as a local variable. When the "n + 1" trie

[issue37234] error in variable

2019-06-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This tracker is for issues related to CPython. The examples presented in the report look more like user error with variables where N is not defined in the first examples. Can you please illustrate over the examples over how this is an issue with in

[issue37234] error in variable

2019-06-11 Thread Mahdi Jafary
New submission from Mahdi Jafary : this code is ok def test(t): n = 0 def f(t): print(t+str(N)) f(t) test('test') but this code have error def test(t): n = 0 def f(t): n = n+1 print(t+str(n)) f(t