You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restrict allowed "verbose" values, or make the verbose kwarg a keyword-only argument? #8258
Call me stupid but I just spent 5 minutes trying to "debug" why this wasn't doing as I expected:
epochs.apply_baseline(None, 0)
Obviously, the baseline period should be specified as a tuple… What happened here is that instead of throwing an error message, I ended up with Epochs without baseline correction. Signature of apply_baseline is:
While you could always argue that of course you should check your results and that you cannot make a software fool-proof, I was still wondering if we couldn't easily prevent some of those "user bugs" from happening. In this particular case, either being more restrictive on the allowed values of verbose, or declaring verbose to be a keyword-only argument would have successfully mitigated my inaptness :)
I'm fine with adding the * to functions where verbose is close to the other arguments. We can even just start with apply_baseline for 0.21 as I agree it's a likely candidate for this problem.
I'm also fine with making the verbose decorator more picky, but let's do that early in 0.22
Activity
cbrnr commentedon Sep 15, 2020
I like both suggestions: make
verbosea kw-only argument and restrict its values.hoechenberger commentedon Sep 15, 2020
There's a third (complementary) solution: at one point, we should start discussing adding type annotations.
cbrnr commentedon Sep 15, 2020
Let's try to move this point as far as possible into the future...
larsoner commentedon Sep 15, 2020
I'm fine with adding the
*to functions whereverboseis close to the other arguments. We can even just start withapply_baselinefor 0.21 as I agree it's a likely candidate for this problem.I'm also fine with making the
verbosedecorator more picky, but let's do that early in 0.22hoechenberger commentedon Sep 15, 2020
I can do this later tonight I believe.
agramfort commentedon Sep 15, 2020
hoechenberger commentedon Sep 15, 2020
I literally had to run this code to figure out what's wrong with it. Ouch.