I'm fairly experienced with Python, but as I was helping out a friend with a script, I noticed he had solved a common problem in a different way than I was familiar with. He is making sure that the user input is in a valid format (a float); I am used to seeing something like this, which is also what all answers I could find say:
def get_input()
    while True:
        try:
            val = float(input("input pls"))
            return val
        except:
            print("not valid, try again)
He had however solved it using recursion, like this:
def get_input():
    try:
        val = float(input("input pls"))
        return val
    except:
        print("not valid, try again")
        return get_input()
Is there any downside to this?
 
     
    