In this file I am using a dictionary named modelDict
declared globally and I am using it in multiple functions (addCharToModelDict, dumpModelDict
). I haven't used global
keyword inside these functions to use the global modelDict
.
addCharToModelDict
is updating it and dumpModelDict
is writing it back to file in the end.
Everything works fine!!
Why this is happening?? Isn't using global keyword is necessary??