python function: how to unset a default argument value


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.".

Asked By: idiot



Simply pass new values to your function on call:

def func(a=10, b=2)
   print(a, b)

Call with default arguments:


Call with non-default arguments:

func(20, 3)
Answered By: Bohdan

answer is that I had to set it to None and it worked

Answered By: idiot
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.