Created
August 25, 2018 04:46
-
-
Save Fhernd/a517c4693665dea982eab05e103489cd to your computer and use it in GitHub Desktop.
Invocación de función con diferente número de argumentos al requerido. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
def sumar(a, b, c, d): | |
return a + b + c + d | |
# Producen error: | |
# sumar(2, 3, 4) | |
# sumar(7, 11) | |
# Uso de la función `partial`: | |
sumar1 = partial(sumar, 1) | |
sumar2 = partial(sumar, 3, 5) | |
print(sumar1(2, 3, 4)) | |
print(sumar2(7, 11)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment