ipython-autoimport
ipython-autoimport copied to clipboard
There may be a bug occured when I use 'global' keyword.
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.