Report [for k, v in set: k]
as anti-pattern diagnostic
#1609
Labels
enhancement
New feature or request
[for k, v in set: k]
as anti-pattern diagnostic
#1609
Language Server Version
v0.32.6
Problem Statement
Users can today use the following syntax to loop over a set:
This is functionally equivalent to
In other words, looping over "set keys" is allowed but sets are not sorted (hence don't have indexes like lists or tuples) and don't really have their own keys either (like maps or objects).
Therefore, out of the two examples, only the bottom one should be considered best practice.
Attempted Solutions
No response
Proposal
Related LSP methods
No response
References
No response
Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: