Skip to content
Advertisement

Tag: global-variables

Setting back global variables back to their default value

In game,I have created some global variables whose value changes when a certain action occur.When I restart the game,I want their value to be set again to their initial value. I can change global variable value by equilazing it back to its original value. Is there any other way to do so,when there are lot of variables,I can’t make them

How to access Aʟʟ global variables in a function?

I’m trying to mimic the matlab load and save functions. I’m following this thread: Shelve Code gives KeyError It is smart. However, if I write that code in a separate module, and try to import that module and invoke that function, then it can’t access the global variables. Specifically, I write a happy.py and have the functions inside: and when

Reason for globals() in Python?

What is the reason of having globals() function in Python? It only returns dictionary of global variables, which are already global, so they can be used anywhere… I’m asking only out of curiosity, trying to learn python. I can’t really see the point here? Only time I would need it, was if I had local and global variables, with same

Advertisement