Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Boolean-Trap: add variants of FTB001-FTB003 for None. #11165

Open
randolf-scholz opened this issue Apr 26, 2024 · 0 comments
Open

[ENH] Boolean-Trap: add variants of FTB001-FTB003 for None. #11165

randolf-scholz opened this issue Apr 26, 2024 · 0 comments
Labels
rule Implementing or modifying a lint rule

Comments

@randolf-scholz
Copy link

The same rationale behind the Boolean-Trap can be applied to None arguments, especially rule FBT003

class Slider:
    def __init__(xmin: float, xmax: float, initial_value: Optional[float] = None):
          self.xmin = xmin
          self.xmax = xmax
          initial_value = (xmin+xmax)/2 if initial_value is None else initial_value

Slider(0, 1, None)  # <--- meaning of None unclear
Slider(0, 1)  # <--- better
Slider(0, 1, initial_value=None)  # <--- better
@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

2 participants