Open coderelease opened 2 years ago
If loaded the ipython-autoimport module, It will be found that the x variable can not be changed by function which global keyword is inside.
x = "AAAAA" def myfunc(): global x x = "BBBBB" myfunc() print(x)
the correct output is "BBBBB", but "AAAAA" output when use ipython autoimport.
Good catch. This probably requires mucking with ip.global_user_ns (instead of just ip.user_ns), but I don't know much about its inner workings... A PR would be welcome.
If loaded the ipython-autoimport module, It will be found that the x variable can not be changed by function which global keyword is inside.
the correct output is "BBBBB", but "AAAAA" output when use ipython autoimport.