New GitHub issue #118598 from vladimirrotariu:<br>

<hr>

<pre>
# Feature or enhancement

### Proposal:

Currently, in situations like
```python
count = 10
for _ in count:
    pass
```
or the analogous list comprehension situation, the error message of the ensuing TypeError is
`'int' object is not iterable`

The improved error message would look like:
`'int' object is not iterable. Did you mean: 'range('int')'?` 

The original TypeError error message `'int' object is not iterable`  results from other prohibited operations as well, such as 
```python
{1, *1, 0, 4}
```
in which case the proposed suggestion is irrelevant. However, based on searching on StackOverflow  "'int' object is not iterable", the majority of issues fall into the first situation.

### Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

### Links to previous discussion of this feature:

It is fairly common to try to iterate over an object of type int. Here you may find some guiding links with examples:

Simple for loops:
https://www.codecademy.com/forum_questions/54f231c876b8fe4269002f2f
https://stackoverflow.com/questions/43425270/typeerror-int-object-is-not-iterable
https://blog.arrowhitech.com/typeerror-int-object-is-not-iterable-in-python-what-is-it-and-solution/
List comprehensions:
https://stackoverflow.com/questions/32312371/typeerror-int-object-is-not-iterable

Also, when I searched for "TypeError: 'int' object is not iterable" on StackOverflow, I got the impression that the majority of the issues might be solved with "range('int')", see here:
https://stackoverflow.com/search?q=TypeError%3A+%27int%27+object+is+not+iterable 
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/118598">View on GitHub</a>
<p>Labels: type-feature</p>
<p>Assignee: </p>