I've got a dict of settings for each server in a Discord bot. I've stored the expected type for each setting so that it can be parsed to the correct value when a server admin changes a setting for their server (since parameters are passed as strings). Is there a Python library that allows you do something like:
parse(strValOfSetting, typeOfSetting)
and then get the correct type back? Or do I have to do something like
def parse(strVal, expectedType):
    if isinstance(expectedType, int):
        # parse strVal as int
        ...
    if isinstance(expectedType, tuple):
        ...
    ...
Parsing with a cast like typeOfSetting(strVal) doesn't work for things like booleans because anything other than "" parses to True. That's just an example.
If there's a library that would be cool. If not, I'll just homebrew something.
Thanks
