I haven't found anything near a solution yet, if you could at least give me a clue.. I have this function:
def analizar_consulta(consulta, v):
print('\ntomar consulta: {}\n'.format(consulta))
#transformar todas las variables en su contenido
consulta = transformar_variable(consulta, v)
if consulta[0] in diccionario_funciones.keys():
parametros = list(filter(lambda x: not(isinstance(x,list)), consulta[1:]))
consultas = list(filter( lambda x: isinstance(x,list) , consulta[1:]))
print('parametros: {}'.format(parametros))
print('consultas: {}\n'.format(consultas))
if len(consultas) > 0:
pasadas = list(map(lambda x: analizar_consulta(x, v), consultas))
parametros.append(pasadas)
else:
return diccionario_funciones[consulta[0]](*parametros)
return diccionario_funciones[consulta[0]](*parametros)
else:
raise Exception('Comando no encontrado')
as it is recursive, sometimes it takes arguments from inside the first parameter as a new parameter for itself in a new instance, but sometimes the first argument of the new parameters is a list, which raise an error on the line 5 (consulta[0])
Is there a way to, if there is a list (which only contain numbers), it just returns it instead of continuing with the rest of the code?
Sorry for the code is in Spanish, if you don't understand something I can edit it.
when I try it whit ["comparar", ["PROM", "x"], ">", ["DESV", "y"]] this parameter, it raises the error: TypeError: unhashable type: 'list'