-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Here is a minimal example for the issue I had with PLR1706 and the autofix using ruff v0.1.7.
-print(True and False or 2) # This print '2'
+print(False if True else 2) # This print 'False'I used this command:
echo "print(True and False or 2)" > t.py
ruff check --select PLR1706 --isolated --preview --fix --unsafe-fixes t.pyGenerally speaking, A and B or C is transformed into B if A else C but this is not equivalent when A is truphy and B is falsy because the first one returns C and the second returns B.
Let me know if I'm missing something.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working