Drop C409 tuple comprehension preview behaviour - #25707
Conversation
c85d436 to
712ed7b
Compare
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| unnecessary-literal-within-tuple-call | 17 | 0 | 17 | 0 | 0 |
|
Thanks! It seems like there's not really consensus on what to do about this on the issue. I would personally probably lean toward dropping the preview behavior entirely with the possibility of moving it to a separate rule. It feels a bit strange to me to gate this kind of thing on the Python version, but I'm open to other thoughts. |
|
I'm also all for dropping it entirely, my change here was simply less "aggressive" than that, in case some Python 3.14+ users liked the preview behaviour. |
|
Would a separate rule need to be implemented to drop this behaviour from I could update this PR either way, create a separate issue if needed, and resolve the concerns of #12912 |
|
Let's just drop the preview behavior. The feature has been in preview for almost 2 years now, blocked by #12912, so I think we can just drop it. A follow-up issue does make sense to summarize some of the history and make sure we don't reintroduce the behavior accidentally. I'm happy to write that if you want, or you're certainly welcome to :) Thank you! |
|
Thanks. Before finishing the writeup, I decided to throw an actual test comparing 3.14 and .... I can't even see a noticeable difference there. So I think I won't even make a request for this on 3.14+. It would also mean that my feature request #11839 is still valid in Python 3.14+
|
…"no change" in snapshot
…ply-C409-tuple-comprehension-preview-behaviour-on-Pthon-3.14+
ntBre
left a comment
There was a problem hiding this comment.
Thank you! I just had a small suggestion for one additional deletion.
Summary
Closes #12912 by only applying the tuple generator behavior of the rule on Python 3.14+, where tuple generator expression got optimized in (ref: python/cpython#131737). Rendering the concerns on that issue no longer relevant on those Python versions.
This was especially problematic for
C409as only some behaviour is in preview, not the rule itself, so you couldn't usetool.ruff.lint.explicit-preview-rules = trueTest Plan
TODO (haven't installed cargo)
New snapshot should pass on CI
Note: Code changed by Claude Sonnet 4.6. Reviewed by human, although I don't know much about Rust (but this seems a simple enough change)