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

SIM103 creates double negative #11685

Closed
charliermarsh opened this issue Jun 1, 2024 · 0 comments · Fixed by #11684
Closed

SIM103 creates double negative #11685

charliermarsh opened this issue Jun 1, 2024 · 0 comments · Fixed by #11684
Assignees
Labels
fixes Related to suggested fixes for violations

Comments

@charliermarsh
Copy link
Member

here's another example of an un-pleasing suggestion from SIM103. I wavered over whether to raise this separately but decided is is related enough: easy to split things apart later if desired.

def foo(num: int) -> bool:
    if not 10 < num < 100:
        return False

    return True
foo.py:2:5: SIM103 Return the condition `not not 10 < num < 100` directly
  |
1 |   def foo(num: int) -> bool:
2 |       if not 10 < num < 100:
  |  _____^
3 | |         return False
4 | |
5 | |     return True
  | |_______________^ SIM103
  |
  = help: Replace with `return not not 10 < num < 100`

not not? yuk!

Originally posted by @dimbleby in #6184 (comment)

@charliermarsh charliermarsh self-assigned this Jun 1, 2024
@charliermarsh charliermarsh added the fixes Related to suggested fixes for violations label Jun 1, 2024
charliermarsh added a commit that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant