python function: how to unset a default argument value
Question:
if i have
def (a=10, b=2): ...
how do I unset a=1? I was told I need to not set ‘a’ but I can’t find how to do that on google, it just sets itself to the default value if I don’t have it, and I need to completely unset it
the library is madmom and the instruction was "If look_ahead is not set, a constant tempo throughout the whole piece is assumed. If look_ahead is set, the local tempo (in a range +/- look_ahead seconds around the actual position) is estimated and then the next beat is tracked accordingly. This procedure is repeated from the new position to the end of the piece.". https://madmom.readthedocs.io/en/v0.16/modules/features/beats.html
Answers:
Simply pass new values to your function on call:
def func(a=10, b=2)
print(a, b)
Call with default arguments:
func()
Call with non-default arguments:
func(20, 3)
answer is that I had to set it to None and it worked
if i have
def (a=10, b=2): ...
how do I unset a=1? I was told I need to not set ‘a’ but I can’t find how to do that on google, it just sets itself to the default value if I don’t have it, and I need to completely unset it
the library is madmom and the instruction was "If look_ahead is not set, a constant tempo throughout the whole piece is assumed. If look_ahead is set, the local tempo (in a range +/- look_ahead seconds around the actual position) is estimated and then the next beat is tracked accordingly. This procedure is repeated from the new position to the end of the piece.". https://madmom.readthedocs.io/en/v0.16/modules/features/beats.html
Simply pass new values to your function on call:
def func(a=10, b=2)
print(a, b)
Call with default arguments:
func()
Call with non-default arguments:
func(20, 3)
answer is that I had to set it to None and it worked