#x will be deleted print("x")
""" Since foo is a global, you can delete it from the global definitions: """ def delete_func(func): del globals()[func.func_name]