-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
The fixes for zip-without-explicit-strict (B905) and map-without-explicit-strict (B912) should be marked unsafe by the same reasoning as in this comment:
The issue isn't that our fix would change behavior but that we could silently preserve the wrong behavior. Instead we should alert the user to the issue so that they can decide what it's supposed to say.
$ cat >b9.py <<'# EOF'
print(list(zip("ab", "123")))
print(list(map(lambda x, y: y + x, "ab", "123")))
# EOF
$ python b9.py
[('a', '1'), ('b', '2')]
['1a', '2b']
$ ruff --isolated check b9.py --select B905,B912 --preview --target-version py314 --fix
Found 2 errors (2 fixed, 0 remaining).
$ cat b9.py
print(list(zip("ab", "123", strict=False)))
print(list(map(lambda x, y: y + x, "ab", "123", strict=False)))
$ python3.14 b9.py
[('a', '1'), ('b', '2')]
['1a', '2b']Version
ruff 0.13.3 (188c0dc 2025-10-02)
Metadata
Metadata
Assignees
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations