3 ms·
> Python where keyword arguments need to be declared as such. In Python you don't need to explicitly declare keyword arguments either (though it is possible).
by Denvercoder9 6y ago
> Python where keyword arguments need to be declared as such.
In Python you don't need to explicitly declare keyword arguments either (though it is possible). This is perfectly valid and working:
def foo(a: str, b: int, c: bool=None, d: float=None):
pass
foo(b=5, a='something', d=3.0)
# is equivalent to
foo('something', 5, None, 3.0)
- toupeira 6y agoThanks, TIL!