question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detect redundant enumerate

See original GitHub issue

Rule request

Thesis

# bad
for _, item in enumerate(items):
  ...

# good
for item in items:
  ...

Reasoning

Simplification.

P.S. I’m not making it, have seen it in the wild 🙃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lensvolcommented, Oct 3, 2021

If this is not taken by anybody, can I take it over?

1reaction
sobolevncommented, Feb 8, 2021

Yes, my bad!

I was confused by:

dctnr = {1: 2, 3: 4}
for _, value in dctnr.items():
  ...
for key, _ in dctnr.items():
  ...

This should go to typed-linter rule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I find the duplicates in a list and create another list ...
To remove duplicates use set(a) . To print duplicates, something like: a = [1,2,3,2,1,5,6,5,5,5] import collections print([item for item, count in ...
Read more >
How To Find Duplicates in a Python List - Intellisoft Training
Method 1: Using the length of a list to identify if it contains duplicate elements. ... Let's write the Python program to check...
Read more >
Python : 3 ways to check if there are duplicates in a List
Check for duplicates in a list using Set & by comparing sizes · If size of list & set is equal then it...
Read more >
Duplicates in a List Finder - dCode.fr
By listing items, dCode detector counts the number of appearance of each, the list can be sorted to detect the most duplicated ones....
Read more >
How to find duplicates from a list in Python - Educative.io
The list ( l ) with duplicate elements is taken to find the duplicates. · An empty list ( l1 ) is taken...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found