Pergunta

If I define a function, is it ever possible that an exception would be raised for kwargs.get? For example,

def func(**kwargs):
    try:
        a = kwargs.get("a")
    except Exception as e:
        raise ValueError("Would I ever see this error? \n ERROR: %s" % e )
Foi útil?

Solução

No, kwargs.get('somestring') will not raise an exception; you are passed a standard Python dict type in that case.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top