You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While you're absolutely correct on this, and we should fix it, it feels like enough of an edge case that I think we can still stabilise this rule as part of Ruff 0.9. It's just very unlikely that anybody would write code like this, realistically, I think :-)
Was just about to write the same thing - I've never seen this before... and it would seem very strange to rely on that behavior in any case.
It's not even clear to me that we should try to fix this behavior? In a dynamically typed language like Python, even with an excellent type checker, I think it's impractical (bordering on impossible?) to tell if function calls have side effects, statically. At the moment the only prior art in Ruff itself is very heavy-handed: we just assume that all functions have side effects (except for builtins that we think are not being overloaded):
That doesn't really seem appropriate here. We probably could (and should) make this method smarter by teaching it about various builtins and things from the standard library, but for any given rule I think we have to accept some level of approximation to the truth.
slice-to-remove-prefix-or-suffix (FURB188) produces a false positive in Ruff 0.8.6 when the affix expression has a side effect.
The text was updated successfully, but these errors were encountered: