Skip to content
This repository was archived by the owner on Mar 31, 2024. It is now read-only.

Boolean return values swapped for prompt.yn with default="n" #145

@eiszfuchs

Description

@eiszfuchs

I couldn't find an issue dealing with this problem.
Have this example code:

from clint.textui import prompt

for d in range(3):
    print(prompt.yn("Yes?"))

for y in range(3):
    print(prompt.yn("Yes? default=y", default="y"))

for n in range(3):
    print(prompt.yn("Yes? default=n", default="n"))

Output is:

Yes? [Y/n] y
True
Yes? [Y/n] n
False
Yes? [Y/n] 
True
Yes? default=y [Y/n] y
True
Yes? default=y [Y/n] n
False
Yes? default=y [Y/n] 
True
Yes? default=n [y/N] y
False
Yes? default=n [y/N] n
True
Yes? default=n [y/N] 
True

If I chose "n" for default, the boolean value is negative.
I think this line should be the other way round:
https://github.com/kennethreitz/clint/blob/master/clint/textui/prompt.py#L59

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