Iterable can be either a string or a sequence¶
ID: py/iteration-string-and-sequence
Kind: problem
Security severity:
Severity: error
Precision: high
Tags:
- quality
- reliability
- correctness
Query suites:
- python-code-quality.qls
- python-security-and-quality.qls
Click to see the query in the CodeQL repository
The for statement is designed to allow you to iterate over the elements of a sequence or other iterable object. Strings in Python are iterable, and often used as such. However, they are also often considered, not as sequences of characters, but as atomic entities.