Here is the function:
def genWords():
global wordsList; global current_char; global char_seq_cords; global current_sequence
current_sequence = "%s%s" % (current_sequence, getChar(current_char))
testable_prefixes = map( lambda x: ["%s%s" % (current_sequence, getChar(x)), x], possible_chars() )
valid_seqs = filter(lambda x: linguisticly_possible_seq(x[0]),
testable_prefixes) # 2 length list with char seq and char cords second
for i in valid_seqs:
if (u"%s" % current_sequence).lower() in english_tree:
wordsList.append(current_sequence)
current_char = i[1]
char_seq_cords.append(current_char)
genWords()
if not valid_seqs:
wordsList.append(current_sequence)
return wordsList
print genWords()
print wordsList
I would expect the output from print genWords()
to be a list, instead it is None
. The reason I am so confused is because the final line print wordsList
prints the expected output; additionally, if I insert this line, print wordsList
, right before return wordsList
, I again get the expected output. I can't seem to figure out why the function returns None?
The src here if you need reference: https://docs.google.com/document/d/1okYiW3jIkZF8HDwpU5Efx32HHkl1hlqcFj0lP6Io0oY/edit?usp=sharing