Add the `iter()` builtin to checker `C407`
See original GitHub issueiter()
Example:
even_iterator = iter([i for i in range(1,100) if i%2 == 0])
This can be directly written as:
even_iterator = iter(i for i in range(1,100) if i%2 == 0)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Python iter() (With Examples) - Programiz
In this tutorial, you will learn about the Python iter() with the help of examples. The iter() method returns an iterator for the...
Read more >itertools — Functions creating iterators for efficient looping ...
This module implements a number of iterator building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a...
Read more >How does the built-in function iter() convert a Python list to an ...
I check a list and find it has no __next__ method. When using iter() on it, it will become an iterator. Does this...
Read more >4. Iterators and Generators - Python Cookbook, 3rd ... - O'Reilly
The use of the iter() function here is a bit of a shortcut that cleans up the code. iter(s) simply returns the underlying...
Read more >Python iter() function - w3resource
The iter() function returns an iterator object. Version: (Python 3.2.5). Syntax: ... Python: Built-in-function - iter() function.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#59 deals with
<expr>[0]
. This issue is just about a plain iter, which always raises aStopIteration
when empty.You’re right!