Re: python global dictionary not saving modifications
I am 99% sure that the problem here is that this code is trying to do something to the effect of modifying a dict in another module, but by importing the dict in the current module. But it's a lot of very meh code and I don't ahve the energy to pick it apart. But specifically:
import mydict from mymodule
def modify():
# works
mydict["foo"]
def modify_broken(): # Doesn't work mydict = dict()
You should do this in the first place. Please, please learn to just add functions to modules that do this. But if you do need it to work, you have to:
import mymodule
mymodule.mydict = dict()
Python does not have globals in the fashion that you want. Your programs should not have globals in this way either. if you're importing global variables from other modules you have probably failed. This may not be the bug, but it's usually the buig when people claim it's broken. Why the latter works and the former doesn't is complicated, but if you don't do this then you don't need to know, so just don't do this.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector