What I understand from reading the documentation is that Python has a separate namespace for functions, and if I want to use a global variable in that function, I need to us
global
Example:
words = [...]
def contains (word):
global words # <- not really needed
return (word in words)
def add (word):
global words # must specify that we're working with a global keyword
if word not in words:
words += [word]