I have the below function doing fuzzymatching on people's names. It takes a dictionary with keys that are names I'm matching on. It's expensive to create the dictionary and I will use the function in notebooks where a may already have the dictionary created...so I want to leave the option to not create it each time I run the function. For that, I've defaulted it to be None so I can pass it if needed. If I don't have it initialized already, it will do so on its own.
Note that get_player_dict() is the function that returns the dictionary:
def match_player_names(input_name, player_dict=None):
    matches = []
    if player_dict:
        for player in list(map(lambda player: player.lower(), player_dict.keys())):
            if fuzz.partial_ratio(input_name, player) > 75:
                matches.append(player)
    else:
        match_player_names(input_name, player_dict=get_player_dict())
    return matches
This returns nothing (matches is []).  However, if I simply copy/paste the code in the True condition and replace the recursion with an initialization of the dictionary, it works fine (like below):
    else:
        for player in list(map(lambda player: player.lower(), player_dict.keys())):
            if fuzz.partial_ratio(input_name, player) > 75:
                matches.append(player)
Any ideas why the recursion wouldn't work?
 
    