Skip to content

Restrict allowed "verbose" values, or make the verbose kwarg a keyword-only argument? #8258

@hoechenberger

Description

@hoechenberger

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:

    @verbose
    def apply_baseline(self, baseline=(None, 0), verbose=None):

So verbose was simply set to 0.

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 :)

    def apply_baseline(self, baseline=(None, 0), *, verbose=None):

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions