{"action":"created","issue":{"url":"https://api.github.com/repos/IIC2233/Syllabus/issues/354","repository_url":"https://api.github.com/repos/IIC2233/Syllabus","labels_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/354/labels{/name}","comments_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/354/comments","events_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/354/events","html_url":"https://github.com/IIC2233/Syllabus/issues/354","id":317836307,"number":354,"title":"Duda Ayudantía 6","user":{"login":"Cschavez","id":37157327,"avatar_url":"https://avatars1.githubusercontent.com/u/37157327?v=4","gravatar_id":"","url":"https://api.github.com/users/Cschavez","html_url":"https://github.com/Cschavez","followers_url":"https://api.github.com/users/Cschavez/followers","following_url":"https://api.github.com/users/Cschavez/following{/other_user}","gists_url":"https://api.github.com/users/Cschavez/gists{/gist_id}","starred_url":"https://api.github.com/users/Cschavez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cschavez/subscriptions","organizations_url":"https://api.github.com/users/Cschavez/orgs","repos_url":"https://api.github.com/users/Cschavez/repos","events_url":"https://api.github.com/users/Cschavez/events{/privacy}","received_events_url":"https://api.github.com/users/Cschavez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-26T00:21:39Z","updated_at":"2018-04-26T00:47:34Z","closed_at":null,"author_association":"NONE","body":"Hola! En el método verify_types(...), así como está en la solución, al imprimir la función \"saludar\" imprime None. Haciendo la ayudantía yo dentro de verify_types(..) puse : return funcion(*args, **kwargs)  dentro de \"_verificar_tipos\" y ahí si imprime el resultado de la función si hago\r\n`print(saludar(\"hola\"))`\r\ny si está efectivamente tiene el input y output correcto.\r\n Mi pregunta es si, al menos para ese caso en particular, no es necesario hacer lo que dije recién y da igual que al printiar se imprima \"None\", o si existe alguna razón en particular por lo que de igual cualquiera de las dos formas de hacerlo. Espero se haya entendido:(\r\nMuchas gracias !\r\n![image](https://user-images.githubusercontent.com/37157327/39279270-55c1881e-48ce-11e8-8519-fb8f9bfd40cf.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/IIC2233/Syllabus/issues/comments/384477583","html_url":"https://github.com/IIC2233/Syllabus/issues/354#issuecomment-384477583","issue_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/354","id":384477583,"user":{"login":"fgbruna","id":26395700,"avatar_url":"https://avatars2.githubusercontent.com/u/26395700?v=4","gravatar_id":"","url":"https://api.github.com/users/fgbruna","html_url":"https://github.com/fgbruna","followers_url":"https://api.github.com/users/fgbruna/followers","following_url":"https://api.github.com/users/fgbruna/following{/other_user}","gists_url":"https://api.github.com/users/fgbruna/gists{/gist_id}","starred_url":"https://api.github.com/users/fgbruna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgbruna/subscriptions","organizations_url":"https://api.github.com/users/fgbruna/orgs","repos_url":"https://api.github.com/users/fgbruna/repos","events_url":"https://api.github.com/users/fgbruna/events{/privacy}","received_events_url":"https://api.github.com/users/fgbruna/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T00:47:34Z","updated_at":"2018-04-26T00:47:34Z","author_association":"MEMBER","body":"Hola!, efectivamente en este caso, y debido a como construimos la función `_verificar_tipos` esta no retornara nada ya que no definimos su retorno usando la _keyword_ `return`.\r\n**Si quieres obtener lo que retornaba `saludar` originalmente** deberias hacerlo así:\r\n```python\r\ndef verify_types(input_type, output_type):\r\n    \"\"\"\r\n    Verifica que el primer argumento de una función sea del tipo input type y que\r\n    el valor de retorno sea del tipo output type. En caso contrario, lanzar una\r\n    excepción de clase TypeError.\r\n    \"\"\"\r\n    def verificar_tipos(f):\r\n        def _verificar_tipos(*args, **kwargs):\r\n            if args and not isinstance(args[0], input_type): # Verificamos que reciba al menos un argumento\r\n                raise TypeError(\"El primer argumento no es de tipo {}\".format(input_type))\r\n            retorno = f(*args, **kwargs)\r\n            if not isinstance(retorno, output_type):\r\n                raise TypeError(\"El retorno de la función no es del tipo {}\".format(output_type))\r\n            return retorno\r\n        return _verificar_tipos\r\n    return verificar_tipos\r\n```\r\nNota que usamos el retorno **al final**, asi obtendremos el funcionamiento esperado, es decir obtendremos el retorno si y solo si pasa ambas pruebas!"}}
{"actor":{"display_login":"fgbruna"}}