Skip to content

Yesno default not intuitive #4

@Hanse00

Description

@Hanse00

Taken from https://github.com/tylerdave/prompter/blob/master/prompter/__init__.py#L98

while True:
        response = get_input(prompt_text).strip()
        if response == '':
            return True

It seems to me that True is returned on an empty response, regardless of how the default parameter is set. Is this a bug, or have I completely missed something here?

Cheers!

Edit: After a little additional testing, I've found what I misunderstood.
Apparently the values True and False are always the same, but depending on if the default is Yes or No, they flip meaning, as they always mean "Was the default selected?".

I would argue that it would be more sensible to have "True" mean "Yes" and "False" mean "No" in all cases. How do you feel about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions