The value of valid_idx would always be overwritten by the if block.
I think the author intended to write:
if not valid_idx:
valid_idx = 0
But forgot the not in the condition. In fact instead of adding the not we can get rid of the if block and set the valid_idx parameter to a default value of 0.
Before this update, omitting to give the optional parameter valid_idx would produce an exception.
The value of
valid_idx
would always be overwritten by the if block. I think the author intended to write:But forgot the
not
in the condition. In fact instead of adding thenot
we can get rid of the if block and set thevalid_idx
parameter to a default value of 0.Before this update, omitting to give the optional parameter
valid_idx
would produce an exception.